MATLAB Answers

0

how can i count a cell in a randi vector

Asked by adir weiser on 22 Jul 2018
Latest activity Edited by Paolo
on 22 Jul 2018
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

  0 Comments

Sign in to comment.

1 Answer

Answer by Paolo
on 22 Jul 2018
Edited by Paolo
on 22 Jul 2018

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

  0 Comments

Sign in to comment.