strncmp
Performs a case-sensitive comparison of the first n characters of x1 with x2. Returns 1 if the characters compared are identical and 0 otherwise.
Syntax
R = strncmp(x1, x2, n)
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.
 - n
 - Number of characters to match for a case-sensitive comparison.
 
Outputs
- R
 - Type: logical | mat
 
Examples
R = strncmp('string1', 'str123456', 3)R = 1R = strncmp('string1', {'This', 'is', 'str123456'}, 3)R = [Matrix] 1 x 3
0  0  1Comments
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.