Finding numbers over a value in a matrix/array
    2 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
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.
0 commentaires
Réponse acceptée
  Image Analyst
      
      
 le 14 Juin 2013
        
      Modifié(e) : Image Analyst
      
      
 le 14 Juin 2013
  
      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)
3 commentaires
  Image Analyst
      
      
 le 14 Juin 2013
				Yes. You can't write variable names with spaces in them. Plus I don't know why you didn't just do it like I said. Explain what this means " in a certain range/below a certain value eg 0." Do you mean that the limits of the entire range (both the low and high values) are less than 0? Like the low value = -999 and the high value is -1?
Plus de réponses (2)
  Andrei Bobrov
      
      
 le 14 Juin 2013
        A = rand(20,10); 
A(A < .3) = -A(A < .3); % your array
out = nnz(A < 0);
Voir également
Catégories
				En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



