string.strncmp
string: TF = strncmp (A, B, n)
Compare first n characters of strings.
TF is true, if the first n characters of strings
A and B are lexicographically equal. If one input is a
string array, the other input can be a string array, a character vector,
or a cell array of character vectors.
If either A or B is a string array or a cell array of character vectors, then a logical array TF of the same size is returned, containing the values described above for every member of the array. In this case, the other argument may also be a string array or a cell array of character vectors (of the same size or scalar), or a character vector.
Source Code: string