source: issm/trunk-jpl/src/m/Geometry/find_point.m@ 12996

Last change on this file since 12996 was 12650, checked in by Mathieu Morlighem, 13 years ago

return only the first occurence

File size: 446 bytes
Line 
1function f=find_point(tabx,taby,pointx,pointy)
2%FIND_POINT - find closest point
3%
4% find which point of the list (tabx,taby) is
5% the closest to (poinx,pointy)
6%
7% Usage:
8% f=find_point(tabx,taby,pointx,pointy)
9
10%Compute distance between point and cloud of points
11distance=sqrt((tabx-pointx).^2+(taby-pointy).^2);
12
13%find index of the minimum distance and return the first one only
14f=find(distance==min(min(distance)),1);
Note: See TracBrowser for help on using the repository browser.