count elements falling within certain thresholds in array in matlab? -


i have huge vector. have count values falling within ranges. ranges 0-10, 10-20 etc. have count number of values fall in range.

i did :

for i=1:numel(m1) if (0<m1(i)<=10)==1 k=k+1; end end 

also:

if not(isnan(m1))==1 x=(0<m1<=10); end 

but both times gives array contains 1s. wrong doing?

you can (also works non integers)

k = sum(m1>0 & m1<=10) 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -