recognition of different cases

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

Answers (1)

yesorno = input('Run the function again? (Yes/No)\n','s')
Then compare upper(yesorno) with 'YES' or 'NO'

This question is closed.

Asked:

on 1 May 2016

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!