Matrix does not compile
    4 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Jon Camilleri
 le 21 Nov 2015
  
    
    
    
    
    Commenté : Image Analyst
      
      
 le 21 Nov 2015
            I am trying to create a bit string, however, this does not compile:
if ((iris_data{1,1} < mean(iris_data{1,1}) r={1,0,0,0};
Error: Unexpected MATLab expression
NOTE: Hitting enter does not appear to feed a carriage return to the forum.
0 commentaires
Réponse acceptée
  James Tursa
      
      
 le 21 Nov 2015
        
      Modifié(e) : James Tursa
      
      
 le 21 Nov 2015
  
      Looks like you have unbalanced parentheses. E.g., this would fix that problem:
if iris_data{1,1} < mean(iris_data{1,1})
    r={1,0,0,0};
end
BUT I have to question the logic in this. It looks like you may have a vector expression here:
iris_data{1,1} < mean(iris_data{1,1})
Which would mean the if-test is likely not doing what you really wanted. Can you explain in more detail what you want this if-test to do? What exactly is iris_data{1,1}, and what is r supposed to be?
2 commentaires
  Image Analyst
      
      
 le 21 Nov 2015
				Well when they're cells, we call it a "cell array" rather than a matrix, though actually it is a matrix composed of cells. Please, please, please read the FAQ on cells.
So, the upper left cell, iris_data{1,1} -- what is that? Is it a single scalar number? Or is it a vector or a whole matrix? And why are you using cells instead of a much, much simpler numerical array, which, by the way has far less overhead and takes up far less memory?
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Multidimensional Arrays 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!


