index must be a positive integer or logical
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    med-sweng
 el 27 de Feb. de 2014
  
    
    
    
    
    Editada: Mischa Kim
    
      
 el 27 de Feb. de 2014
            For the following operation in my code:
    result = max((1)-(abs(sum_A-sum_B)/sum_A-sum_C),0);
I got the following error:
Attempted to access max(356.87,0); index must be a positive integer or
logical.
Although I'm intending to simply retrieve the maximum value here, provided that when I run the line as stand-alone, I get the max retrieved correctly.
What could be the issue?
Thanks.
0 comentarios
Respuesta aceptada
  Mischa Kim
    
      
 el 27 de Feb. de 2014
        
      Editada: Mischa Kim
    
      
 el 27 de Feb. de 2014
  
      Are you using max as a variable somewhere in your code? If not, it's probably in your workspace, so do a
 clear max
and re-run your code. At any rate, try to avoid variable names that are also function names or reserved words.
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Logical en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

