how can i count a cell in a randi vector

1 回表示 (過去 30 日間)
adir weiser
adir weiser 2018 年 7 月 22 日
編集済み: Paolo 2018 年 7 月 22 日
hi, i have a randi vector like: randi(4,1,50). and i need to count who much time the number '1' appear in my vector. as well the number '2' and '3' and '4'
thanks alot

回答 (1 件)

Paolo
Paolo 2018 年 7 月 22 日
編集済み: Paolo 2018 年 7 月 22 日
histcounts(randi(4,1,50))
The output of the function is the occurrences of numbers one to four respectively.

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by