Compare strings
compares strings tf = strcmp(s1,s2)s1 and s2. Returns
0 if the two strings are identical. Otherwise returns a
nonzero integer.
The sign of the output value depends on the lexicographic ordering of
the input strings s1 and
s2.
The magnitude of the output value depends on the compiler that you use. This value can differ in simulation and generated code.
Strings are considered identical when they have the same size and content.
This operator is consistent with the C library function strcmp
or the C++ function string.compare, depending on the compiler
that you select for code generation. The operator behaves differently than the
function strcmp in MATLAB®.
is an
alternative way to execute s1 == s2strcmp(s1,s2) == 0.
is an
alternative way to execute s1 != s2strcmp(s1,s2) != 0.
returns tf = strcmp(s1,s2,n)0 if the first n characters in
s1 and s2 are identical.
Note
The operator strcmp is supported only in Stateflow® charts that use C as the action language.
Enclose literal strings with single or double quotes.