Skip to content

dsearchn

geometry · scripts/geometry/dsearchn.m

: k = dsearchn (x, xi)
: k = dsearchn (x, t, xi)
: k = dsearchn (x, t, xi, outind)
: [k, d] = dsearchn (…)

Find the point of x nearest to each query point.

x is m-by-n (one point per row) and xi is p-by-n. The result k is a column of row indices into x and d holds the corresponding Euclidean distances. Ties go to the lowest index.

With four arguments, query points outside every simplex of the triangulation t of x receive the value outind instead. A query point containing NaN gives NaN.