フィルターのクリア

Most Frequent numbers in a Matrix

1 回表示 (過去 30 日間)
João
João 2013 年 12 月 22 日
コメント済み: João 2013 年 12 月 23 日
Good night all,
I hope you call help me with this question.
I have a matrix like this in Matlab.
2012 1 1 0
2012 1 1 0
2012 1 1 0
2012 1 1 0
2012 1 1 1
2012 1 1 1
(...)
Now I want to get the most frequent number in groups of 4 rows. For example;
2012 1 1 0
2012 1 1 1

採用された回答

Image Analyst
Image Analyst 2013 年 12 月 23 日
編集済み: Image Analyst 2013 年 12 月 23 日
Perhaps you want the unique() function:
A=[2012 1 1 0
2012 1 1 0
2012 1 1 0
2012 1 1 0
2012 1 1 1
2012 1 1 1];
[C,ia,ic] = unique(A,'rows')
Well, at least it gives you what you asked for, for the matrix you gave. C is exactly what you said the output should be.
  1 件のコメント
João
João 2013 年 12 月 23 日
Perfect! Exactly what I want, thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by