Asked by Brian
on 14 Jun 2013

Hi, I have a 365x10 matrix/array? not sure what it would be called need to find the amount of numbers in a certain range/below a certain value eg 0.

Thanks for any help.

*No products are associated with this question.*

Answer by Image Analyst
on 14 Jun 2013

Edited by Image Analyst
on 14 Jun 2013

Accepted answer

Try this:

T = rand(365,10); % Some random data

% Define the range as [0, 0.2]. rangesLowValue = 0; rangesHighValue = 0.2; % Count the number of values in the range: countLessThanPoint3 = sum(T(:) >= rangesLowValue & T(:)<rangesHighValue)

Image Analyst
on 14 Jun 2013

Answer by Andrei Bobrov
on 14 Jun 2013

A = rand(20,10); A(A < .3) = -A(A < .3); % your array

out = nnz(A < 0);

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments