MATLAB: Error using == Matrix dimensions must agree.

Hi, I want a solution to this problem. Someone can help me?
Error in operations (line 5)
elseif c == 'multi'

Best Answer

  • I have no idea what the matrix dimension problem is, since we have only one line of your code. However, the way to compare strings and string variables is to use the strcmp or strcmpi functions.
    So the correct syntax for the line you posted would be:
    elseif strcmpi(c, 'multi')