Find all neighbors within specified distance using input data

For a fixed positive real value

`r`

,`rangesearch`

finds all the`X`

points that are within a distance`r`

of each`Y`

point. To find the*k*points in`X`

that are nearest to each`Y`

point, for a fixed positive integer*k*, use`knnsearch`

.`rangesearch`

does not save a search object. To create a search object, use`createns`

.

For an overview of the

*k*d-tree algorithm, see k-Nearest Neighbor Search Using a Kd-Tree.The exhaustive search algorithm finds the distance from each point in

`X`

to each point in`Y`

.

If you set the `rangesearch`

function `'NSMethod'`

name-value pair argument to the appropriate value (`'exhaustive'`

for an
exhaustive search algorithm or `'kdtree'`

for a *K*d-tree
algorithm), then the search results are equivalent to the results obtained by conducting a
distance search using the `rangesearch`

object function. Unlike the
`rangesearch`

function, the `rangesearch`

object function requires an `ExhaustiveSearcher`

or `KDTreeSearcher`

model object.

`ExhaustiveSearcher`

| `KDTreeSearcher`

| `createns`

| `knnsearch`

| `pdist2`

| `rangesearch`