フィルターのクリア

Help with creating histogram

1 回表示 (過去 30 日間)
Bright Edison
Bright Edison 2019 年 4 月 16 日
コメント済み: Bright Edison 2019 年 4 月 16 日
Can someone help me with this
If I have a random array
>> a = randi(10,10,10)
a =
9 8 10 10 10 4 10 7 2 1
7 5 1 7 6 5 7 9 5 10
6 5 2 5 7 6 6 6 6 7
8 5 6 9 9 4 6 5 2 4
4 7 2 10 9 10 8 3 5 3
9 2 3 3 4 7 2 7 8 5
1 7 9 6 5 2 1 7 5 1
2 7 8 10 5 3 7 7 9 10
4 10 4 3 5 1 9 2 5 5
1 1 1 4 9 7 2 1 10 5
how can i create a histogram of this data in decreasing order of the number of counts for every number 1 to 10. The horizontal axis will be labelled with each number for the corresponding counts.

採用された回答

Duncan Po
Duncan Po 2019 年 4 月 16 日
If you convert to categorical, you can sort the counts by descending order:
a = randi(10,10,10);
histogram(categorical(a), 'DisplayOrder', 'descend');
untitled.png
  1 件のコメント
Bright Edison
Bright Edison 2019 年 4 月 16 日
Thanks

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by