Not Enough Input arguments error
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Isobel Leikis
am 30 Apr. 2022
Kommentiert: Star Strider
am 1 Mai 2022
% generate a random value for x
x = randi([1 100]);
% ask questions and ask for input
prompt1= 'x+4';
ans1 = inputdlg(sprintf("when x = %i \nWhat is x+4?",x));
myicon = imread("Jellybean.png");
%creates a while loop in the event of a correct answer
while input == x+4
msgbox('Correct! The frogs kiss your feet and you move on!',myicon);
%creates an if loop in the event of an incorrect answer
if input ~= x+4
msgbox('Incorrect! You are attacked by frogs! Try again to gain their trust.',myicon);
%retries the loop until the correct answer is given
continue
end
end
%i keep getting this error: Error using input Not enough input arguments. But im not sure where theres more than 1 input
0 Kommentare
Akzeptierte Antwort
Star Strider
am 30 Apr. 2022
The solution is to rename ‘input’ to something else that makes sense in the context of the rest of the code.
Go frogs!
8 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!