フィルターのクリア

Finding the Frequency of Unique Values

19 ビュー (過去 30 日間)
Rightia Rollmann
Rightia Rollmann 2016 年 8 月 13 日
編集済み: Azzi Abdelmalek 2016 年 8 月 13 日
How to return the frequency of each value in array A? (So, B views there are 3, 1, 4, and 2 of 1, 2, 3, and 4, respectively)
A = [ 1 1 4 3 3 3 3 2 4 1 ]
B = [ 3 1 4 2]

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 8 月 13 日
編集済み: Azzi Abdelmalek 2016 年 8 月 13 日
A = [ 1 1 4 3 3 3 3 2 4 1 ]
[ii,jj,kk]=unique(A)
freq=accumarray(kk,1)
out=[ii' freq]
%or
freq=hist(A,1:4)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by