how can i count a cell in a randi vector

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

Antworten (1)

Paolo
Paolo am 22 Jul. 2018
Bearbeitet: Paolo am 22 Jul. 2018

0 Stimmen

histcounts(randi(4,1,50))
The output of the function is the occurrences of numbers one to four respectively.

Kategorien

Mehr zu Vehicle Dynamics Blockset finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 22 Jul. 2018

Bearbeitet:

am 22 Jul. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by