<?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: in matlab, find the array position of an entry closest to some arbitrary value</title>
	<atom:link href="http://desk.stinkpot.org/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/feed/" rel="self" type="application/rss+xml" />
	<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/</link>
	<description>tricks!</description>
	<lastBuildDate>Thu, 02 Feb 2012 20:46:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<item>
		<title>By: Paris</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-24848</link>
		<dc:creator>Paris</dc:creator>
		<pubDate>Sat, 21 Jan 2012 00:00:35 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-24848</guid>
		<description>What if I need the closest entry of the array but within limits?

Example to clarify:

I have the array test=[5,6,7,8,9,10] and I want the index of the entry closest to 5 out of the entries that are &gt;=6 (therefore the index of 6 -&gt; 2).

[~,idx]=min(abs(5-test)) returns 1 of course...

At first I though about trying something like 

[~,idx]=min(abs(5-test(test&gt;=6))) 

but it won&#039;t do since 6 has idx=1 within the test(test&gt;=6) array and therefore the ans is still idx=1.

Any ideas?</description>
		<content:encoded><![CDATA[<p>What if I need the closest entry of the array but within limits?</p>
<p>Example to clarify:</p>
<p>I have the array test=[5,6,7,8,9,10] and I want the index of the entry closest to 5 out of the entries that are &gt;=6 (therefore the index of 6 -&gt; 2).</p>
<p>[~,idx]=min(abs(5-test)) returns 1 of course&#8230;</p>
<p>At first I though about trying something like </p>
<p>[~,idx]=min(abs(5-test(test&gt;=6))) </p>
<p>but it won&#8217;t do since 6 has idx=1 within the test(test&gt;=6) array and therefore the ans is still idx=1.</p>
<p>Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-24067</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Fri, 09 Dec 2011 01:16:14 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-24067</guid>
		<description>Edit to above; I forgot to type &quot;function&quot;

function [i,j,k] = closest_match(M,a)</description>
		<content:encoded><![CDATA[<p>Edit to above; I forgot to type &#8220;function&#8221;</p>
<p>function [i,j,k] = closest_match(M,a)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-24066</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Fri, 09 Dec 2011 01:14:43 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-24066</guid>
		<description>For multidimensional matrices:

[i,j,k] = closest_match(M,a)
% Find the indices of the value closest to a in matrix M
[~, linear_index] = min(abs(T(:)-val)));
[i,j,k] = ind2sub(size(T),linear_index)</description>
		<content:encoded><![CDATA[<p>For multidimensional matrices:</p>
<p>[i,j,k] = closest_match(M,a)<br />
% Find the indices of the value closest to a in matrix M<br />
[~, linear_index] = min(abs(T(:)-val)));<br />
[i,j,k] = ind2sub(size(T),linear_index)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michele</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-23922</link>
		<dc:creator>Michele</dc:creator>
		<pubDate>Wed, 30 Nov 2011 16:03:11 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-23922</guid>
		<description>Hi!
I need to find a value in different Array(n,m).
I try to use something like this:
[n,m]=find(A47==9941005309)
and this works well, so i need a loop that for i=1:47 searchs 9941005309 in A1, A2, Ai...
I tried like this: 

 [n,m]=find(R,num2str(l)==9941005309)

where R=&#039;A&#039; but it doesn&#039;t work, where I&#039;m wrong?
Thanks for help me!</description>
		<content:encoded><![CDATA[<p>Hi!<br />
I need to find a value in different Array(n,m).<br />
I try to use something like this:<br />
[n,m]=find(A47==9941005309)<br />
and this works well, so i need a loop that for i=1:47 searchs 9941005309 in A1, A2, Ai&#8230;<br />
I tried like this: </p>
<p> [n,m]=find(R,num2str(l)==9941005309)</p>
<p>where R=&#8217;A&#8217; but it doesn&#8217;t work, where I&#8217;m wrong?<br />
Thanks for help me!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: basu</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-22739</link>
		<dc:creator>basu</dc:creator>
		<pubDate>Sat, 03 Sep 2011 16:45:03 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-22739</guid>
		<description>how to find proximity matrix of binary data?

and how to find angle for bounding boxes of binary image using PCA</description>
		<content:encoded><![CDATA[<p>how to find proximity matrix of binary data?</p>
<p>and how to find angle for bounding boxes of binary image using PCA</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kostas</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-22563</link>
		<dc:creator>Kostas</dc:creator>
		<pubDate>Wed, 10 Aug 2011 21:32:10 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-22563</guid>
		<description>Worked brilliant, thanks!</description>
		<content:encoded><![CDATA[<p>Worked brilliant, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kelz</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-21809</link>
		<dc:creator>Kelz</dc:creator>
		<pubDate>Mon, 25 Jul 2011 23:45:52 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-21809</guid>
		<description>Hi, I have a very large matrix, i have the matrix index (x,y,z) but im intrested in the actual value of this index in the original array. How do I go about this? Kelz</description>
		<content:encoded><![CDATA[<p>Hi, I have a very large matrix, i have the matrix index (x,y,z) but im intrested in the actual value of this index in the original array. How do I go about this? Kelz</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kelz</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-21808</link>
		<dc:creator>Kelz</dc:creator>
		<pubDate>Mon, 25 Jul 2011 23:44:58 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-21808</guid>
		<description>Hi, I have a very large matrix, i have the matrix index (x,y,z) but im intrested in the actual value of this index in the original array. How do I go about this?</description>
		<content:encoded><![CDATA[<p>Hi, I have a very large matrix, i have the matrix index (x,y,z) but im intrested in the actual value of this index in the original array. How do I go about this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rabindra Rimal</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-12755</link>
		<dc:creator>Rabindra Rimal</dc:creator>
		<pubDate>Thu, 24 Mar 2011 00:37:40 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-12755</guid>
		<description>great8 (°_°)!
thanks a lot! 
i had spend more then 10hrs for it.
thank you soo much.
&lt;3 &lt;3</description>
		<content:encoded><![CDATA[<p>great8 (°_°)!<br />
thanks a lot!<br />
i had spend more then 10hrs for it.<br />
thank you soo much.<br />
&lt;3 &lt;3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nipun</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2006/03/in-matlab-find-the-array-position-of-an-entry-closest-to-some-arbitrary-value/comment-page-1/#comment-12725</link>
		<dc:creator>Nipun</dc:creator>
		<pubDate>Mon, 14 Mar 2011 17:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://stinkpot.afraid.org:8080/tricks/?p=40#comment-12725</guid>
		<description>for finding the exact location of any data in the array (both the row and column)
try this
[I,J] = find(T==max(max(T)))
where T is the array.</description>
		<content:encoded><![CDATA[<p>for finding the exact location of any data in the array (both the row and column)<br />
try this<br />
[I,J] = find(T==max(max(T)))<br />
where T is the array.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

