MATLAB: ‘Not Enough Input Arguments” error in IF statement

errorhelpif statementinputinput arguementsMATLABmatlab function

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

Best Answer

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
Related Question