'Not Enough Input Arguments" error in IF statement

17 Ansichten (letzte 30 Tage)
Abdulla Alshehhi
Abdulla Alshehhi am 29 Apr. 2019
Kommentiert: Adam Danz am 29 Apr. 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

Akzeptierte Antwort

Adam Danz
Adam Danz am 29 Apr. 2019
Bearbeitet: Adam Danz am 29 Apr. 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 Kommentare
Abdulla Alshehhi
Abdulla Alshehhi am 29 Apr. 2019
I think this time it did work, thank you!!!
Adam Danz
Adam Danz am 29 Apr. 2019
Nice job! If it breaks again, feel free to follow-up here with a comment.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by