MATLAB: Help with “matrix dimensions must agree”.

dimensionserrorif statement

In my code I have an input that says answer = input('Please type "yes" or no".','s'); if answer == 'yes' blah blah else disp('Error, please make sure a file is uploaded.') end
For some reason when I enter "no", there is a problem where it says "Error. Matrix dimensions don't agree." But when i enter "n" it gives me my custom error statement for the else condition.

Best Answer

Change the if condition to:
if strcmp(answer, 'yes')
Related Question