Hello,
given two double matrices of size (606x3), where each column indicates the XYZ coordinates of a point.
How can I calculate the distance between the two points ??

 Akzeptierte Antwort

Stephan
Stephan am 15 Mär. 2019

0 Stimmen

dist = sqrt((A(:,1)-B(:,1)).^2 + (A(:,2)-B(:,2)).^2 + (A(:,3)-B(:,3)).^2);

Weitere Antworten (1)

Torsten
Torsten am 15 Mär. 2019
Bearbeitet: Torsten am 15 Mär. 2019

2 Stimmen

You mean "where each row indicates the XYZ coordinates of a point" ? And you want to calculate the distance between the corresponding points of the two matrices ?
dist = vecnorm(A-B,2,2)

2 Kommentare

Guido Pastore
Guido Pastore am 15 Mär. 2019
Thank you so much
Stephan
Stephan am 15 Mär. 2019
more smart solution

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 15 Mär. 2019

Kommentiert:

am 15 Mär. 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by