Help Center
Determine if input is string array
tf = isstring(A)
tf = isstring(A) returns 1 (true) if A is a string array. Otherwise, it returns 0 (false).
A
1
true
0
false
example
collapse all
Create different arrays, and then determine if they are string arrays.
Test a character vector.
chr = 'Mary Jones'
tf = isstring(chr)
tf = logical 0
Character vectors are not strings, so isstring returns 0.
isstring
Test a string array.
str = ["Smith","Chung","Morales"; ... "Sanchez","Peterson","Adams"]
str = 2x3 string "Smith" "Chung" "Morales" "Sanchez" "Peterson" "Adams"
tf = isstring(str)
tf = logical 1
str is a string array, so isstring returns 1.
str
Input array, specified as a scalar, vector, matrix, or multidimensional array. A can be any data type.
backgroundPool
ThreadPool
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Introduced in R2016b
cellstr | char | iscategorical | iscell | isstrprop | isstruct | isa | iscellstr | istable | ischar | string | isStringScalar
cellstr
char
iscategorical
iscell
isstrprop
isstruct
isa
iscellstr
istable
ischar
string
isStringScalar
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
Europe
Asia Pacific
Contact your local office