Filter löschen
Filter löschen

distance between array and matrix

2 Ansichten (letzte 30 Tage)
Mireia Boneta Camí
Mireia Boneta Camí am 3 Nov. 2020
Beantwortet: KSSV am 3 Nov. 2020
Hello everybody,
I have a matrix P with size 3xN and another matrix T with size 3x480. The 3 rows that have the two matrix make reference to the x,y,z of each point. What I want to do is compute the distance of every of the 480 points of matrix T with all the points of matrix P, obtaining a D matrix of 480xN. Can i do this without fors and loops? Thanks.

Akzeptierte Antwort

KSSV
KSSV am 3 Nov. 2020
Read about pdist2.
A = rand(3,480) ;
d = pdist2(A',A') ; % required distances

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by