MATLAB: How to know the quatity of the number in an array

array

my data is:
A=[1 1 2 1 1 1 2 1 1 1 3 3 3 1 1 3 4 1 2 1 2 2 1 1 1 1 3 2 2 3 1 7 1 1 1 1 3 1 1 5 2 1 1 1 1 1 1 1 1 1 1 1 4 1 1 2 2 1 2 4 3 4 1 1 2 2 2 1 1 1 1 2 2 3 1 2 2 1 2 2 3 3 3 2 1 2 1 3 3 4 2 1 1 4 1 1 2 1 1 3 1 2 2 1 1 1 1 1 3 3 2 1 3 2 1 2 1 1 2 1 1 2 1 2 1 1 1 2 1 1 1 2 2 1 2 1 1 1 1 1 1 1 1 1 3 2 2 1 1 2 1 1 1 1 1 1 1 2 3 3 2 2 1 1 2 1 1 4 1 1 2 3 1 3 1 1 1 2 2 3 1 2 1 1 3 1 1 2 2 1 ]
I want to know how many times or the quantity of number 1 in my array.
thank you.

Best Answer

out=sum(A(A==1))
Related Question