<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Inverse Mapping from Values to Indices</title>
	<atom:link href="http://blogs.mathworks.com/loren/2006/06/14/inverse-mapping-from-values-to-indices/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/loren/2006/06/14/inverse-mapping-from-values-to-indices/</link>
	<description>Loren Shure works on design of the MATLAB language at MathWorks. She writes here about once a week on MATLAB programming and related topics.</description>
	<lastBuildDate>Thu, 09 Feb 2012 04:19:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Ken Crounse</title>
		<link>http://blogs.mathworks.com/loren/2006/06/14/inverse-mapping-from-values-to-indices/#comment-10036</link>
		<dc:creator>Ken Crounse</dc:creator>
		<pubDate>Wed, 06 Sep 2006 21:15:33 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=41#comment-10036</guid>
		<description>Another one function solution -- it&#039;s amazing how many Matlab functions do the same exact thing ;-)

M = interp1(a, 1:numel(a), Minit)

Ken</description>
		<content:encoded><![CDATA[<p>Another one function solution &#8212; it&#8217;s amazing how many Matlab functions do the same exact thing ;-)</p>
<p>M = interp1(a, 1:numel(a), Minit)</p>
<p>Ken</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/06/14/inverse-mapping-from-values-to-indices/#comment-1118</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Wed, 21 Jun 2006 19:55:49 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=41#comment-1118</guid>
		<description>Lucio-

Thanks!  I should have seen that :-(

--Loren</description>
		<content:encoded><![CDATA[<p>Lucio-</p>
<p>Thanks!  I should have seen that :-(</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucio</title>
		<link>http://blogs.mathworks.com/loren/2006/06/14/inverse-mapping-from-values-to-indices/#comment-1117</link>
		<dc:creator>Lucio</dc:creator>
		<pubDate>Wed, 21 Jun 2006 19:45:54 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=41#comment-1117</guid>
		<description>We can also vectorize loopFR, it looks nicer and a little faster

function M1 = loopFR(M,A)

imap(A) = 1:length(A);  
M1 = imap(M);</description>
		<content:encoded><![CDATA[<p>We can also vectorize loopFR, it looks nicer and a little faster</p>
<p>function M1 = loopFR(M,A)</p>
<p>imap(A) = 1:length(A);<br />
M1 = imap(M);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Petr Pošík</title>
		<link>http://blogs.mathworks.com/loren/2006/06/14/inverse-mapping-from-values-to-indices/#comment-371</link>
		<dc:creator>Petr Pošík</dc:creator>
		<pubDate>Thu, 15 Jun 2006 07:31:44 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=41#comment-371</guid>
		<description>Hi Loren and blog readers!

There is another simple way of doing that:

&lt;code&gt;
function M1 = loopFR(M,A)
% loopFR replaces M with its indices from A.

M1 = M;
for i = 1:length(A),
    M1(find(M == A(i))) = i;
end
&lt;/code&gt;

This is, however, not a scalable solution as the number of passes through the matrix M increases with the number of vector A elements. In the tests, it is slightly better than the ismember function, maybe they are implemented in a similar way.</description>
		<content:encoded><![CDATA[<p>Hi Loren and blog readers!</p>
<p>There is another simple way of doing that:</p>
<p><code><br />
function M1 = loopFR(M,A)<br />
% loopFR replaces M with its indices from A.</code></p>
<p>M1 = M;<br />
for i = 1:length(A),<br />
    M1(find(M == A(i))) = i;<br />
end<br />
</p>
<p>This is, however, not a scalable solution as the number of passes through the matrix M increases with the number of vector A elements. In the tests, it is slightly better than the ismember function, maybe they are implemented in a similar way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus</title>
		<link>http://blogs.mathworks.com/loren/2006/06/14/inverse-mapping-from-values-to-indices/#comment-361</link>
		<dc:creator>Markus</dc:creator>
		<pubDate>Wed, 14 Jun 2006 20:42:38 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=41#comment-361</guid>
		<description>I suggest to use function cputime for performance measurements, like here:

t0 = cputime;
% evaluate function
dt = cputime - t0;
disp(sprintf(&#039;Elapsed cpu time = %g seconds.&#039;, dt));

The difference to tic and toc is that here only the cpu time used by Matlab is counted, not that of other running processes.</description>
		<content:encoded><![CDATA[<p>I suggest to use function cputime for performance measurements, like here:</p>
<p>t0 = cputime;<br />
% evaluate function<br />
dt = cputime &#8211; t0;<br />
disp(sprintf(&#8216;Elapsed cpu time = %g seconds.&#8217;, dt));</p>
<p>The difference to tic and toc is that here only the cpu time used by Matlab is counted, not that of other running processes.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

