<?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: Logical indexing</title>
	<atom:link href="http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/</link>
	<description>Steve Eddins manages the Image &#38; Geospatial development team at The MathWorks and coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.</description>
	<lastBuildDate>Wed, 22 May 2013 10:54:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-23064</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 29 Apr 2010 11:45:49 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-23064</guid>
		<description><![CDATA[Morten&#8212;I misinterpreted your last comment. I thought you were asking for a comparison of performance between linear and logical indexing because you used a syntax that looked like linear indexing in your question. Anyway, you need to use &lt;a href=&quot;http://blogs.mathworks.com/steve/2008/02/08/linear-indexing/&quot; rel=&quot;nofollow&quot;&gt;linear indexing&lt;/a&gt;, like this:

&lt;pre class=&quot;code&quot;&gt;
pixels = image(sub2ind(size(image), rows, cols));
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Morten&mdash;I misinterpreted your last comment. I thought you were asking for a comparison of performance between linear and logical indexing because you used a syntax that looked like linear indexing in your question. Anyway, you need to use <a href="http://blogs.mathworks.com/steve/2008/02/08/linear-indexing/" rel="nofollow">linear indexing</a>, like this:</p>
<pre class="code">
pixels = image(sub2ind(size(image), rows, cols));
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morten</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-23062</link>
		<dc:creator>Morten</dc:creator>
		<pubDate>Thu, 29 Apr 2010 08:28:29 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-23062</guid>
		<description><![CDATA[Hi Steve
As it is now I use
&lt;pre&gt;
pixels = zeros(size(rows));
for i=1:2000
   pixels(i) = image(rows(i),cols(i));
end
&lt;/pre&gt;
because that was the straight to use my input data (rows and cols) for indexing. And the indexing is the bottleneck of my algorithm - I have of cause checked this through profiling. It will take some extensive code modifications to get this right, so I was just asking you, in order to do it right from the start - you might have had a quick answer. But I guess I&#039;ll just go with one of them and a new profiling will show whether the indexing is still the bottleneck.

Thanks,

Morten]]></description>
		<content:encoded><![CDATA[<p>Hi Steve<br />
As it is now I use</p>
<pre>
pixels = zeros(size(rows));
for i=1:2000
   pixels(i) = image(rows(i),cols(i));
end
</pre>
<p>because that was the straight to use my input data (rows and cols) for indexing. And the indexing is the bottleneck of my algorithm &#8211; I have of cause checked this through profiling. It will take some extensive code modifications to get this right, so I was just asking you, in order to do it right from the start &#8211; you might have had a quick answer. But I guess I&#8217;ll just go with one of them and a new profiling will show whether the indexing is still the bottleneck.</p>
<p>Thanks,</p>
<p>Morten</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-23060</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 29 Apr 2010 01:27:07 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-23060</guid>
		<description><![CDATA[Morten&#8212;I don&#039;t know.  I wouldn&#039;t even bother trying to find out unless detailed profiling demonstrated that it was a true bottleneck in the context of the rest of your algorithm.]]></description>
		<content:encoded><![CDATA[<p>Morten&mdash;I don&#8217;t know.  I wouldn&#8217;t even bother trying to find out unless detailed profiling demonstrated that it was a true bottleneck in the context of the rest of your algorithm.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morten</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-23055</link>
		<dc:creator>Morten</dc:creator>
		<pubDate>Wed, 28 Apr 2010 14:40:34 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-23055</guid>
		<description><![CDATA[Hi Steve
I need to index a number of pixels in an image, say 2000 locations in a 1024x1024 uint8 image. What is the fastest way to get the pixel values at these locations?
&lt;pre&gt;
pixels = image(index); % size(index) = [1,2000]
&lt;/pre&gt;
or&lt;pre&gt;
pixels = image(binary); % size(binary) = [1024,1024]&lt;/pre&gt;
Or maybe some smarter way? And does the choice of method depend on the &#039;pixels_indexed/image_size&#039;-ratio (a method might be the fastest when indexing a few pixels in a large picture but the slowest when indexing many pixels in a small picture)?
Hope you have an answer for this.

Morten]]></description>
		<content:encoded><![CDATA[<p>Hi Steve<br />
I need to index a number of pixels in an image, say 2000 locations in a 1024&#215;1024 uint8 image. What is the fastest way to get the pixel values at these locations?</p>
<pre>
pixels = image(index); % size(index) = [1,2000]
</pre>
<p>or
<pre>
pixels = image(binary); % size(binary) = [1024,1024]</pre>
</p><p>Or maybe some smarter way? And does the choice of method depend on the &#8216;pixels_indexed/image_size&#8217;-ratio (a method might be the fastest when indexing a few pixels in a large picture but the slowest when indexing many pixels in a small picture)?<br />
Hope you have an answer for this.</p>
<p>Morten</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronny</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-22806</link>
		<dc:creator>Ronny</dc:creator>
		<pubDate>Fri, 05 Mar 2010 18:45:48 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-22806</guid>
		<description><![CDATA[Hii Steve, I found the solution, I used inpolygon(X,Y,xv,yv) as in the example:
L = linspace(0,2.*pi,6); xv = cos(L)&#039;;yv = sin(L)&#039;;
xv = [xv ; xv(1)]; yv = [yv ; yv(1)];
x = randn(250,1); y = randn(250,1);
in = inpolygon(x,y,xv,yv);
plot(xv,yv,x(in),y(in),&#039;r+&#039;,x(~in),y(~in),&#039;bo&#039;)

This function is useful,

Thank you,

Ronny]]></description>
		<content:encoded><![CDATA[<p>Hii Steve, I found the solution, I used inpolygon(X,Y,xv,yv) as in the example:<br />
L = linspace(0,2.*pi,6); xv = cos(L)&#8217;;yv = sin(L)&#8217;;<br />
xv = [xv ; xv(1)]; yv = [yv ; yv(1)];<br />
x = randn(250,1); y = randn(250,1);<br />
in = inpolygon(x,y,xv,yv);<br />
plot(xv,yv,x(in),y(in),&#8217;r+&#8217;,x(~in),y(~in),&#8217;bo&#8217;)</p>
<p>This function is useful,</p>
<p>Thank you,</p>
<p>Ronny</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronny</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-22805</link>
		<dc:creator>Ronny</dc:creator>
		<pubDate>Fri, 05 Mar 2010 13:42:04 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-22805</guid>
		<description><![CDATA[Hi, Steve I think that I didn&#039;t explain me very well, I am sorry for my English. I have the following problem, I have a matrix (3000x3), the points in the matrix are coordinates X,Y,Z, I need to divide my map in 9 similar portions or little windows:
w1 w2 w3
w4 w5 w6
w7 w8 w9
I defined my limits for every window, but I can&#039;t to find the right operation, recently i apply logical operations  and the result it doesn&#039;t match with operation with filter on excel. I think that if I use find operator may be work, but I don&#039;t know how can I to create the matrix from index.
If you know the best way please let me know,

Thank a lot,

Ronny]]></description>
		<content:encoded><![CDATA[<p>Hi, Steve I think that I didn&#8217;t explain me very well, I am sorry for my English. I have the following problem, I have a matrix (3000&#215;3), the points in the matrix are coordinates X,Y,Z, I need to divide my map in 9 similar portions or little windows:<br />
w1 w2 w3<br />
w4 w5 w6<br />
w7 w8 w9<br />
I defined my limits for every window, but I can&#8217;t to find the right operation, recently i apply logical operations  and the result it doesn&#8217;t match with operation with filter on excel. I think that if I use find operator may be work, but I don&#8217;t know how can I to create the matrix from index.<br />
If you know the best way please let me know,</p>
<p>Thank a lot,</p>
<p>Ronny</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-22795</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 03 Mar 2010 20:42:07 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-22795</guid>
		<description><![CDATA[Ronny&#8212;Sounds like basic MATLAB array indexing:

&lt;pre class=&quot;code&quot;&gt;
B = A(xmin:xmax, ymin:ymax, zmin:zmax);
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Ronny&mdash;Sounds like basic MATLAB array indexing:</p>
<pre class="code">
B = A(xmin:xmax, ymin:ymax, zmin:zmax);
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronny</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-22794</link>
		<dc:creator>Ronny</dc:creator>
		<pubDate>Wed, 03 Mar 2010 19:29:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-22794</guid>
		<description><![CDATA[Hi Steve,
I have a question, I am trying to do a function for to create a submatrix (X,Y,Z) from another bigger (X,Y,Z), I need to extract from a range (xmin,xmax; ymin,ymax), I tried for several ways, for example with &quot;for cicle&quot;, &quot;find&quot;, &quot;logical&quot;, but I can&#039;t find the right code, please let me know if you know a best way. 
Thank you so much,

RM]]></description>
		<content:encoded><![CDATA[<p>Hi Steve,<br />
I have a question, I am trying to do a function for to create a submatrix (X,Y,Z) from another bigger (X,Y,Z), I need to extract from a range (xmin,xmax; ymin,ymax), I tried for several ways, for example with &#8220;for cicle&#8221;, &#8220;find&#8221;, &#8220;logical&#8221;, but I can&#8217;t find the right code, please let me know if you know a best way.<br />
Thank you so much,</p>
<p>RM</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-20866</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Sat, 12 Jul 2008 16:21:27 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-20866</guid>
		<description><![CDATA[Oliver&#8212;I&#039;m glad you found it useful.]]></description>
		<content:encoded><![CDATA[<p>Oliver&mdash;I&#8217;m glad you found it useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oliver A. Chapman, P.E.</title>
		<link>http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-20864</link>
		<dc:creator>Oliver A. Chapman, P.E.</dc:creator>
		<pubDate>Fri, 11 Jul 2008 18:24:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/#comment-20864</guid>
		<description><![CDATA[Steve,

Thanks for directing me to this.  It is very well written.]]></description>
		<content:encoded><![CDATA[<p>Steve,</p>
<p>Thanks for directing me to this.  It is very well written.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
