Finding the closest neighbouring coordinates in 3D
34 views (last 30 days)
Show older comments
Hello community,
The data I have is a matrix with X,Y,Z coordinates. I need to find the neighboring points in a mesh. For instance, the point N381 has the closest neighbors N380, N388, N382 and N374.
I was first thinking about comparing the coordinates one by one to each other and look for the minumums, but it feels like when I work on a large size matrix it will demand a lot of computation. Does anyone have an idea to proceed in a more practical way?
Best regards
0 Comments
Accepted Answer
Rik
on 20 Mar 2019
As suggested here, if you have the statistics toolbox, you can use the pdist function. If you have more structured data (e.g. a mesh), you could probably prevent having to calculate all inter-point distances. Note that you will 'only' have to call pdist once to calculate all distances.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!