How can one create frequency table of two dimensional data?

1 回表示 (過去 30 日間)
alpedhuez
alpedhuez 2020 年 7 月 28 日
コメント済み: alpedhuez 2020 年 7 月 28 日
First, I have multidimensional data that look like
0 1
0 2
1 1
1 2
0 2
Second, I want to create a frequency table that counts the frequency of each row such as
0 1 1
0 2 2
1 1 1
1 2 1
where the third column counts the number of occurances of each two-dimensional row.
Third, I looked at tabluate function at
But it seems that the tabulate function only looks at the one-dimensional data.
Then, how can one create a frequency table for such multidimensional data?

採用された回答

madhan ravi
madhan ravi 2020 年 7 月 28 日
編集済み: madhan ravi 2020 年 7 月 28 日
[u, ~, c] = unique(data, 'rows', 'stable');
Wanted = [u, accumarray(c, 1)]

その他の回答 (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