invalid syntax at '=' . A '(' might be missing a closing ')'
    1 visualización (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    valerio auricchio
 el 29 de Mzo. de 2019
  
    
    
    
    
    Comentada: Guillaume
      
      
 el 29 de Mzo. de 2019
            The error is at line 14 and 26
switch nargin
    case 0
        disp('Non ci sono stati input per la funzione!')
    case 1
        if (f = 0)
        disp('Non hai inserito correttamente la funzione la funzione')
        end
    case 2
        if(~isscalar(xo) || isinteger(xo))
        disp('Mammt')
        end
    case 3
        if(~isscalar(xo) || isinteger(xo)) % anche se ci sta un altro controllo che nello non vuole dirmi
        disp('A')
        end
    case 4
        if(~isinteger(NMAX) || NMAX = 0 || ischar(NMAX))
        disp('A pecrrrr, cioè nmax non va bene')
        end
end
0 comentarios
Respuesta aceptada
  Catalytic
      
 el 29 de Mzo. de 2019
        
      Editada: Catalytic
      
 el 29 de Mzo. de 2019
  
      if (f == 0)
and same thing in this line
      if(~isinteger(NMAX) || NMAX == 0 || ischar(NMAX))
1 comentario
  Guillaume
      
      
 el 29 de Mzo. de 2019
				Note that matlab is not C, there is no need to enclose a conditional statement in (), so
if f == 0
if ~isinteger(NMAX)  || NMAX == 0 || ischar(NMAX)
Note that isinteger check that the type is integer not that the values are integer,
>> isinteger(1)   %return false, since double is not an integer type
ans =
  logical
   0
>> isinteger(uint8(1))  %return true, the type is integer
ans =
  logical
   1
I suspect that you meant to test if the value was integer, not the type.
Also note that the ischar(NMAX) is redundant, if NMAX is char, it will have failed the ~isinteger test.
validateattributes(f, {'numeric'}, {'nonzero', 'scalar'});
validateattributes(NMAX, {'numeric'}, {'integer', 'nonzero', 'scalar'})
Más respuestas (0)
Ver también
Categorías
				Más información sobre Tables 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!

