'Not Enough Input Arguments" error in IF statement

17 visualizaciones (últimos 30 días)
Abdulla Alshehhi
Abdulla Alshehhi el 29 de Abr. de 2019
Comentada: Adam Danz el 29 de Abr. de 2019
I seem to be have an issue with my function, where I would get this error, Heres my code;
The error occurs in [ If (N <10000 ], where it says 'Not Enough Input Arguements. I dont understand, its supposed to be only one variable.
function SmB = Big(N)
%SArranges a number in ascending order
NUMARR= zeros(1,4);
if (N <10000 )
Fourth = mod(N,10);
Third = ( mod(N,100) - (mod(N,10)))/10;
Second = ( mod(N,1000) - (mod(N,100)) )/100;
First = ( mod(N,10000) - (mod(N,1000)) )/1000;
elseif (N<1000) % 3 digit number
First = 0;
Fourth = mod(N,10);
Third = ( mod(N,100) - (mod(N,10)))/10;
Second = ( mod(N,1000) - (mod(N,100)) )/100;
elseif( N<100) %2 digit
First = 0;
Second = 0;
Fourth = mod(N,10);
Third = ( mod(N,100) - (mod(N,10)))/10;
elseif (N<10) %1 digit
First = 0;
Second = 0;
Third = 0;
Fourth = mod(N,10);
end
NUMARR(1,1) = First;
NUMARR(1,2) = Second;
NUMARR(1,3) = Third;
NUMARR(1,4) = Fourth;
sort(NUMARR);
SmB = (NUMARR(1,1)*1000) + (NUMARR(1,2)*100) + (NUMARR(1,3)*10) + (NUMARR(1,4)) ;
end

Respuesta aceptada

Adam Danz
Adam Danz el 29 de Abr. de 2019
Editada: Adam Danz el 29 de Abr. de 2019
You're probably running the function without an input. You must include an input.
Big(77); %this doesn't produce an error
Big(); %This DOES produce an error
Big; %This DOES produce an error
Bin([]); %This DOES produce an error
  2 comentarios
Abdulla Alshehhi
Abdulla Alshehhi el 29 de Abr. de 2019
I think this time it did work, thank you!!!
Adam Danz
Adam Danz el 29 de Abr. de 2019
Nice job! If it breaks again, feel free to follow-up here with a comment.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by