frequency determination

4 ビュー (過去 30 日間)
Mohammad Golam Kibria
Mohammad Golam Kibria 2011 年 5 月 8 日
Hi I have a matrix as follows:
A=[1 2 3; 2 3 2; 1 2 3]
I need to determine the frequency of the matrix value. i.e.
the frequency of 1 is 2 the frequency of 2 is 4 the frequency of 3 is 3
How to do this easily.

採用された回答

Oleg Komarov
Oleg Komarov 2011 年 5 月 8 日
c = histc(A(:),unique(A))
  3 件のコメント
Oleg Komarov
Oleg Komarov 2011 年 5 月 8 日
Didn't notice the ; in your A. Edited above.
Teja Muppirala
Teja Muppirala 2011 年 5 月 8 日
A similar alternative:
[counts,values] = hist(A(:),unique(A))

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by