From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Computing euclidean distances between every row of a position matrix
Date: Wed, 1 Jun 2011 20:21:04 +0000 (UTC)
Organization: Princeton University
Lines: 6
Message-ID: <is66vg$ruv$>
References: <is3lku$ku1$> <is3rco$5vj$> <is5g9t$gs9$> <is613u$9a6$> <is6658$pbh$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1306959664 28639 (1 Jun 2011 20:21:04 GMT)
NNTP-Posting-Date: Wed, 1 Jun 2011 20:21:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2886263
Xref: comp.soft-sys.matlab:729752

"Image Analyst" wrote in message <is6658$pbh$>...
> How about
> minDistances = min(distanceMatrix(distanceMatrix>0), [], 2);
> That way, you're only computing the minimum of values that are greater than zero.  The elements having values that are zero (or less) are ignored.

Thanks very much for the suggestion. I actually just realized that I can use the sort function to sort the distance matrix and then it's really easy to get any number of minimum values, and there indices are a piece of cake! Maybe that realization will help someone else in the future- seriously, way easier than dealing with the min function.