MATLAB: Finding the number of values bigger than a certain number in an array

matlab proportion array number of elements bigger than less than

Suppose I have an array of 50 numbers, how would I find the number of elements bigger than say 21 in an array of random numbers? Conversely, for less than as well.

Best Answer

x=50*rand(7);
a= x > 21;
numel(a(a>0))
Related Question