フィルターのクリア

distance between array and matrix

2 ビュー (過去 30 日間)
Mireia Boneta Camí
Mireia Boneta Camí 2020 年 11 月 3 日
回答済み: KSSV 2020 年 11 月 3 日
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.

採用された回答

KSSV
KSSV 2020 年 11 月 3 日
Read about pdist2.
A = rand(3,480) ;
d = pdist2(A',A') ; % required distances

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by