how can i count a cell in a randi vector

조회 수: 2 (최근 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 CenterFile Exchange에서 Statistics 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