strcmpi
Performs a case-insensitive comparison of x1 with x2. Returns 1 if the characters compared are identical and 0 otherwise.
Syntax
R = strcmpi(x1, x2)
Inputs
- x1
- If x1 is a cell, it should either have a size of 1 or match the size of x2.
- x2
- If x2 is a cell, it should either have a size of 1 or match the size of x1.
Outputs
- R
- Type: logical | mat
Examples
Case-insensitive string
comparison:
R = strcmpi('string1', 'STRING1')
R = 1
Case-insensitive string-cell array
comparison:
R = strcmpi('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.