NEAR finds the indices of x that are closest to the point x0. function [index,distance]=near(x,x0,[n]); x is an array, x0 is a point, n is the number of closest points to get (in order of increasing distance). Distance is the abs(x-x0)

- tind TIND finds index of Julian day array closest to the specified Gregorian time

0001 function [index,distance]=near(x,x0,n); 0002 % NEAR finds the indices of x that are closest to the point x0. 0003 %function [index,distance]=near(x,x0,[n]); 0004 % x is an array, x0 is a point, n is the number of closest points to get 0005 % (in order of increasing distance). Distance is the abs(x-x0) 0006 if nargin==2 0007 n=1; 0008 end 0009 [distance,index]=sort(abs(x-x0)); 0010 distance=distance(1:n); 0011 index=index(1:n);

Generated on Thu 01-Dec-2005 08:50:35 by