Determine if input is string array
tf = isstring(A)
example
tf = isstring(A) returns 1 (true) if A is a string array. Otherwise, it returns 0 (false).
A
1
true
0
false
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. Starting in R2017a, you can create strings using double quotes.
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.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
cellstr | char | is* | isa | iscategorical | iscell | iscellstr | ischar | isStringScalar | isstrprop | isstruct | istable | string
cellstr
char
is*
isa
iscategorical
iscell
iscellstr
ischar
isStringScalar
isstrprop
isstruct
istable
string
You have a modified version of this example. Do you want to open this example with your edits?