Compare first n
characters of strings
(case insensitive)
TF = strncmpi(str,str,n)
TF = strncmpi(str,C,n)
TF = strncmpi(C,C,n)
compares
the first TF
= strncmpi(str
,str
,n
)n
characters of two character vectors
for equality, ignoring any differences in letter case. The function
returns a scalar logical 1 for equality, or scalar logical 0 for inequality.
compares
the first TF
= strncmpi(str
,C
,n
)n
characters of a character vector with
the first n
characters of each element of a cell
array of character vectors, ignoring letter case. The function returns
a logical array the same size as the C
input in
which logical 1 represents equality. The order of the input arguments
is not important.
compares
each element of one cell array of character vectors with the same
element of the other, ignoring letter case. TF
= strncmpi(C
,C
,n
)strncmpi
attempts
to match only the first n
characters of these character
vectors. The function returns a logical array the same size as either
input array.
|
A character vector or m-by-n character array. |
|
A cell array of character vectors. |
|
Maximum number of characters to compare. Must be a scalar, integer-valued double. |
|
When both inputs are character arrays, When either or both inputs are a cell array of character vectors, |
From a list of 10 MATLAB® functions, find those that apply to using a camera. Do the comparison without sensitivity to letter case:
function_list = {'calendar' 'case' 'camdolly' 'circshift' ... 'caxis' 'Camtarget' 'cast' 'camorbit' ... 'callib' 'cart2sph'}; strncmpi(function_list, 'CAM', 3) ans = 0 0 1 0 0 1 0 1 0 0 function_list{strncmpi(function_list, 'CAM', 3)} ans = camdolly ans = Camtarget ans = camorbit