Calculate distance of one 5D point from all points of 5D matrix

7 ビュー (過去 30 日間)
abaza
abaza 2018 年 7 月 24 日
コメント済み: abaza 2018 年 7 月 24 日
Dear All, could someone help me to calculate the distance between a 5 dimensional point from all 5 dimensional points of a matrix? Namely, I have a point A within a vector of size 1x5 and I would like to calculate 1000 distances between this point from a matrix 1000x5 (1000 points).
Thank you in advance

採用された回答

Ali Aghaeifar
Ali Aghaeifar 2018 年 7 月 24 日
I think you are looking for pdist2
A = rand(1,5);
B = rand(1000,5);
C = pdist2(A, B);
  1 件のコメント
abaza
abaza 2018 年 7 月 24 日
Thanks! I did not know that pdist2 works with different size vectors/matrices!

サインインしてコメントする。

その他の回答 (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