I use Nearest
repeatedly for large data sets. For example
pts = RandomReal[{-1, 1}, {1000, 3}];
Nearest[pts, {0, 0, 0}]
I am interested in the index of the nearest point, so I use
ind = First@Nearest[pts -> Automatic, {0, 0, 0}]
How do I create a NearestFunction
that can return an index. Returning a point is easy
nf = Nearest[pts];
nf[{0, 0, 0}]
but there is seemingly no option to return the index?
Comments
Post a Comment