Finding the closest neighbouring coordinates in 3D
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
Rik
el 20 de Mzo. de 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 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!