strcmp

Performs a case-sensitive comparison of x1 with x2. Returns 1 if the characters compared are identical and 0 otherwise.

Syntax

R = strcmp(x1, x2)

Inputs

x1
If x1 is a cell, it should either have a size of 1 or match the size of x2.
Type: String string | cell
x2
If x2 is a cell, it should either have a size of 1 or match the size of x1.
Type: String string | cell

Outputs

R
Type: logical | mat

Examples

String comparison:
R = strcmp('string1', 'string1')
R = 1
String-cell array comparison:
R = strcmp('string1', {'This', 'is', 'string1'})
R = [Matrix] 1 x 3
0  0  1

Comments

If x1 and x2 are both of type cell, their sizes must be identical or one of them should have just one element. R will be a matrix if either x1 or x2 is of type cell.