respond equal a character ?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ugur Sahin
am 3 Mai 2020
Bearbeitet: Stephen23
am 4 Mai 2020
hi all,
I did it,
accept=input('do you want to play again, Yes(Y,y), No(N,n); \n','s');
while accept~='Y'||accept~='y'||accept~='N'||accept~='n'
accept=input('do you want to play again, Yes(Y,y), No(N,n); \n','s');
end
and it is not working. I couldn't save quastion of while loop can anyone help me ?
1 Kommentar
Akzeptierte Antwort
Walter Roberson
am 3 Mai 2020
Use strcmp() or strcmpi() or ismember()
Using ~= together with "||" will fail if the user enters more than one character.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings 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!