Publisher review:NEARESTPOINT - find the nearest value in another vector IND = NEARESTPOINT(X,Y) finds the value in Y which is the closest to each value in X, so that abs(Xi-Yk) => abs(Xi-Yj) when k is not equal to j.IND contains the indices of each of these points.Example: NEARESTPOINT([1 4 12],[0 3]) -> [1 2 2][IND,D] = ... also returns the absolute distances in D,that is D == abs(X - Y(IND))NEARESTPOINT(X, Y, M) specifies the operation mode M: 1) 'nearest' : default, same as above2) 'previous': find the points in Y that just precedes a point in XNEARESTPOINT([1 4 12],[0 3],'previous') -> [1 1 1]3) 'next' : find the points in Y that directly follow a point in XNEARESTPOINT([1 4 12],[0 3],'next') -> [2 NaN NaN]If there is no previous or next point in Y for a point X(i), IND(i)will be NaN.X and Y may be unsorted.This function is quite fast, and especially suited for large arrays withtime data. For instance, X and Y may be the times of two separate events, like simple and complex spike data of a neurophysiological study. Run NEARESTPOINT('test') to see a test of it's running time Requirements: ยท MATLAB Release: R13
NEARESTPOINT is a Matlab script for Statistics and Probability scripts design by Josh.
It runs on following operating system: Windows / Linux / Mac OS / BSD / Solaris.
Operating system:Windows / Linux / Mac OS / BSD / Solaris