Combinations of matrix rows

1 回表示 (過去 30 日間)
Amy Diekmann
Amy Diekmann 2017 年 9 月 17 日
コメント済み: KSSV 2017 年 9 月 19 日
I have a matrix of x and y coordinates of points. I used nchoosek to figure out how many different combinations I can have, but how do I get MATLAB to do those combinations? A=[x coord. y coord.] =[1 2; 2 2;3 5;4 7;7 1] I have 5 points and I need to determine the minimum distance between all points (i.e. between points 1 and 2, between points 1 and 3, between points 1 and 5, between points 2 and 3, etc).

採用された回答

KSSV
KSSV 2017 年 9 月 18 日
You need not to see for possible combinations.....read about the function pdist. It gives distance among all possible points.
  2 件のコメント
KSSV
KSSV 2017 年 9 月 19 日
Amy Diekmann commented: Is there a way to determine which two coordinates gives the smallest distance? Thanks!
KSSV
KSSV 2017 年 9 月 19 日
Yes...why not.....check the min of the matrix...and it's indices should give you the concerned points..

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

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