M-File Help: closest | View code for closest |
Find closest points in N-dimensional space.
k = closest(a, b) is the correspondence for N-dimensional point sets a (NxNA) and b (NxNB). k (1 x NA) is such that the element J = k(I), that is, that the I'th column of a is closest to the Jth column of b.
[k,d1] = closest(a, b) as above and d1(I)=|a(I)-b(J)| is the distance of the closest point.
[k,d1,d2] = closest(a, b) as above but also returns the distance to the second closest point.
© 1990-2012 Peter Corke.