matlab number of elements in array greater than 0 code example Example: number of values lager than matlab x=50*rand(7); a= x > 21; numel(a(a>0))