フィルターのクリア

How to find the distance between vectors given in a cell array?

1 回表示 (過去 30 日間)
That Guy
That Guy 2020 年 11 月 12 日
コメント済み: Ameer Hamza 2020 年 11 月 12 日
say i have a cell array in the form p = {[x1, y1], [x2, y2],...,[xn, yn]}
i want to find the number of points that arent within r distance of eachother. I know that pdist will find the distance between points but im not sure how to break this cell array up in order to apply this function. Any help?

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 12 日
You can apply pdist() like this
p = {[x1, y1], [x2, y2], [x3, y3]};
P = vertcat(P{:});
D = pdist(P);
  2 件のコメント
That Guy
That Guy 2020 年 11 月 12 日
thats exactly what i was looking for! thanks!
Ameer Hamza
Ameer Hamza 2020 年 11 月 12 日
I am glad to be of help!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by