フィルターのクリア

How to find mode between two columns?

2 ビュー (過去 30 日間)
Sandy
Sandy 2013 年 7 月 9 日
I have two variables . They are each in a column. I want to find the most common pairs between the two columns.
EX:
12 13
12 15
13 19
34 12
15 90
12 13
90 10
12 13
In this case my most common pair would be 12, 13.
How can I do this?

採用された回答

dpb
dpb 2013 年 7 月 9 日
MATL
[u,~,c] = unique(a,'rows');
[~,ix]=max(accumarray(c,1));
mdrows=u(ix,:);
Encapsulate in function for general use.
  1 件のコメント
Sandy
Sandy 2013 年 7 月 10 日
編集済み: Sandy 2013 年 7 月 10 日
Works perfectly! Thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by