Main Content

isstring

Determine if input is string array

Description

example

tf = isstring(A)returns1(true) ifAis a string array. Otherwise, it returns0(false).

Examples

collapse all

Create different arrays, and then determine if they are string arrays.

Test a character vector.

chr ='Mary Jones'
chr = 'Mary Jones'
tf = isstring(chr)
tf =logical0

Character vectors are not strings, soisstringreturns0.

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 =logical1

stris a string array, soisstringreturns1.

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array.Acan be any data type.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2016b