Fixing Octave string compare

Problem:

You want to compare two strings in Octave like myString == "foobar" but you see an error message like

error: myscript.m: mx_el_eq: nonconformant arguments (op1 is 1x25, op2 is 1x6)
error: called from
    myscript.m at line 26 column 1

Solution

You can’t compare strings using == in Octave!

Use strcmp like this: Instead of myString == "foobar" use

strcmp(myString, "foobar") == 1