Find all neighbors within specified distance using searcher object
searches for all neighbors (i.e., points, rows, or observations) in
Idx
= rangesearch(Mdl
,Y
,r
)Mdl.X
within radius r
of each point (i.e.,
row or observation) in the query data Y
using an exhaustive
search or a Kd-tree. rangesearch
returns
Idx
, which is a column vector of the indices of
Mdl.X
within r
units.
returns the indices of the observation in Idx
= rangesearch(Mdl
,Y
,r
,Name,Value
)Mdl.X
within radius
r
of each observation in Y
with additional
options specified by one or more Name,Value
pair arguments. For
example, you can specify to use a different distance metric than is stored in
Mdl.Distance
or a different distance metric parameter than is
stored in Mdl.DistParameter
.
[
additionally returns the matrix Idx
,D
]
= rangesearch(___)D
using any of the input
arguments in the previous syntaxes. D
contains the distances
between the observations in Mdl.X
within radius
r
of each observation in Y
. By default,
the function arranges the columns of D
in ascending order by
closeness, with respect to the distance metric.
knnsearch
finds the k
(positive integer) points in Mdl.X
that are
k-nearest for each Y
point. In contrast,
rangesearch
finds all the points in Mdl.X
that are within distance r
(positive scalar) of each
Y
point.
rangesearch
is an object function that requires an ExhaustiveSearcher
or a KDTreeSearcher
model object, query data, and a distance. Under equivalent
conditions, rangesearch
returns the same results as rangesearch
when you specify the name-value pair argument
'NSMethod','exhaustive'
or
'NSMethod','kdtree'
, respectively.
createns
| ExhaustiveSearcher
| KDTreeSearcher
| knnsearch
| rangesearch