Find the index of the value in an array that is closest to given
one. By default, no restriction is applied how big the absolute numerical
distance between value
and a value in the array
may be. A limit can be
set by the parameters thresholdAbs
or thresholdRel
. If no value within
the array
has the distance to value
that is equal to or less than the
threshold, the value
is considered not present in the array
and NULL
is returned.
Arguments
- value
Numerical value
- array
Numerical array
- thresholdAbs
Absolute numerical distance by which the closest value in
array
may differ fromvalue
to be accepted. If boththresholdAbs
andthresholdRel
areNULL
(default), no threshold is applied. IfthresholdAbs
is set,thresholdRel
is ignored. If 0, only exact match betweenvalue
andarray
is accepted.- thresholdRel
A fraction by which the closest value may differ from
value
to be accepted. WARNING: setting a relative threshold will result in only exact matches ifvalue
is 0!