strncmpCompares at most
strncmp(s1, s2, n)s1 and s2 should be arrays of characters.n should be a real integer, not equal to NaN.n <= 0, it always returns true.n is Inf, it compares max(numel(s1), numel(s2)) characters.s1 and s2 are equal up to the n-th character.s1 or s2 has less than n characters, it will be expanded to have n characters by packing trailing whitespaces.s1 and s2 are compared in a case-sensitive manner.s1 and s2 are indexed linearly.s1 or s2 is not a character array.a and b have different sizes. strncmp compares their first n characters using linear indexing.a=['ace';'bdf']
b=['abcdex']
strncmp(a,b,5)
strncmp(a,b,6)
a =
ace
bdf
b =
abcdex
ans =
1
ans =
0