Compares two strings for equality. The general syntax for its use is
p = strcmp(x,y)
where x
and y
are two strings. Returns true
if x
and y
are the same size, and are equal (as strings). Otherwise,
it returns false
.
The following piece of code compares two strings:
--> x1 = 'astring'; --> x2 = 'bstring'; --> x3 = 'astring'; --> strcmp(x1,x2) ans = <logical> - size: [1 1] 0 --> strcmp(x1,x3) ans = <logical> - size: [1 1] 1