How to find mode between two columns?

2 次查看(过去 30 天)
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by