How to count tha maximum frequency of an element in a matrix/ array?
1 回表示 (過去 30 日間)
古いコメントを表示
for example if I have an array
x=[1,3,4,2,2,1,1,1,1]
I want to know what is the frequency of each element in the array.
thank you,
2 件のコメント
回答 (1 件)
KSSV
2019 年 1 月 7 日
x=[1,3,4,2,2,1,1,1,1] ;
[c,ia,ib] = unique(x) ;
h = hist(ib) ;
[c' h(h>0)']
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!