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 ==> orToo many input arguments.Error in ==> (file name) at 2whilenot(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