MATLAB: Problem with too many input arguments in “or” function

"or" funtion containing other functionstoo many input arguments

I use a SCRIPT file for writting the commands i want, which i later run. I want to check if the user inputs one of eight specific strings in a string input variable. If not, i want to continue asking the user to input a string, until he inputs one of the eight specific strings. So i tried to to it this way:
category=input('give category: ','s');
while not(or(strcmpi(category,'i'),strcmpi(category,'ii'),strcmpi(category,'iii'),strcmpi(category,'iv'),strcmpi(category,'v'),strcmpi(category,'vi'),strcmpi(category,'vii'),strcmpi(category,'viii')))
disp('ATTENTION: category must be between I and VIII.');
category=input('give category: ','s');
end
When i run this script, whether i give one of the specific strings, or any other string, and i hit "enter", it displays this message on the screen (command window):
??? Error using ==> or
Too many input arguments.
Error in ==> (file name) at 2
while
not(or(strcmpi(category,'i'),strcmpi(category,'ii'),strcmpi(category,'iii'),strcmpi(category,'iv'),strcmpi(category,'v'),strcmpi(category,'vi'),strcmpi(category,'vii'),strcmpi(category,'viii'))
What do i do wrong? Should i do it another way to achieve what i want to do as i have described in the beginning of this message? Thanking you beforehand

Best Answer

The nicer the code, the easier to debug:
while ~any(strcmpi(category, {'i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii'}))
Related Question