recognition of different cases
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
In an assignment for class, one of the problems asks for a function that recognizes any variation of "yes" or "no," such as yES, YEs, No, nO. The question suggests we use the "upper" command. Here's what I have so far, but I feel like I'm approaching it incorrectly
% code
end
yesorno = input('Run the function again? (Yes/No)\n');
yes = 1;
no = 2;
if yesorno == 1
disp('Function restart...')
else
end
Réponses (1)
Azzi Abdelmalek
le 1 Mai 2016
yesorno = input('Run the function again? (Yes/No)\n','s')
Then compare upper(yesorno) with 'YES' or 'NO'
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!