'Not Enough Input Arguments" error in IF statement

조회 수: 17 (최근 30일)
Abdulla Alshehhi
Abdulla Alshehhi 2019년 4월 29일
댓글: Adam Danz 2019년 4월 29일
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

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by