Error using == Matrix dimensions must agree.

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

Risposta accettata

Star Strider
Star Strider il 30 Mag 2015
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 Commenti
Star Strider
Star Strider il 16 Nov 2018
@KenoKanawa — My pleasure!
Dunzhi Chen
Dunzhi Chen il 25 Giu 2020
Thanks, this solved my problem!

Accedi per commentare.

Più risposte (1)

Pronoy Das
Pronoy Das il 25 Feb 2021
Modificato: Pronoy Das il 25 Feb 2021
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"

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by