is there an alternative to pdist2 that calculates the distance between a matrices with different column numbers
10 ビュー (過去 30 日間)
古いコメントを表示
I was wondering if there is a built in matlab fucntion that calculates the distance between two arrays that don't have the same column number like in pdist2? For example if matrix A was 102x3 and Matrix B was 3x15, is there a MATLAB function that can do this calculation for me or do I need to use nested for loops?
0 件のコメント
採用された回答
Adam Danz
2020 年 9 月 4 日
編集済み: Adam Danz
2020 年 9 月 4 日
You just need to transpose B
d = pdist2(A, B');
d(i,j) is the distance between A(i,:) and B(:,j).
4 件のコメント
Adam Danz
2020 年 9 月 5 日
As evidence of what John said, note the indexing I used in my answer to describe d.
d(i,j) is the distance between A(i,:) and B(:,j).
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!