Error using == Matrix dimensions must agree.

1 次查看(过去 30 天)
Hi, I want a solution to this problem. Someone can help me?
Error in operations (line 5)
elseif c == 'multi'

采纳的回答

Star Strider
Star Strider 2015-5-30
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')
  7 个评论

请先登录,再进行评论。

更多回答(1 个)

Pronoy Das
Pronoy Das 2021-2-25
编辑:Pronoy Das 2021-2-25
I came across a similar problem. Simply replace the single quotation marks with the double quotation marks, i.e. replace the line in your code with
c == "multi"

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by