| Contents | Index |
TF = strncmpi(string,string,n)
TF = strncmpi(string,cellstr,n)
TF = strncmpi(cellstr,cellstr,n)
TF = strncmpi(string,string,n) compares the first n characters of two strings for equality, ignoring any differences in letter case. The function returns a scalar logical 1 for equality, or scalar logical 0 for inequality.
TF = strncmpi(string,cellstr,n) compares the first n characters of a string with the first n characters of each element of a cell array of strings, ignoring letter case. The function returns a logical array the same size as the cellstr input in which logical 1 represents equality. The order of the input arguments is not important.
TF = strncmpi(cellstr,cellstr,n) compares each element of one cell array of strings with the same element of the other, ignoring letter case. strncmpi attempts to match only the first n characters of these strings. The function returns a logical array the same size as either input array.
The strncmpi function is intended for comparison of character data. When used to compare numeric data, it returns logical 0.
Use strncmp for case-sensitive string comparisons.
Any leading and trailing blanks in either of the strings are explicitly included in the comparison.
The value returned by strncmpi is not the same as the C language convention.
strncmpi supports international character sets.
string |
A single character string or n-by-1 array of strings. |
cellstr |
A cell array of strings. |
n |
Maximum number of characters to compare. Must be a scalar, integer-valued double. |
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 =
camorbitregexp | regexpi | strcmp | strcmpi | strfind | strncmp

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |