ICLOSE

Syntax: scalar = ICLOSE(vector,scalar)

The ICLOSE function returns the index of vector which corresponds to where vector is closest to the value of scalar, that is, ICLOSE returns the first j where |vector[j]-scalar| is a minimum.

Example

Suppose you have vector X = [1;2;3;4;5]. If you enter A=ICLOSE(X,2.1), the scalar A will have the value 2.