isStringScalar - Determine if input is string array with one element - MATLAB (original) (raw)
Main Content
Determine if input is string array with one element
Syntax
Description
tf = isStringScalar([A](#d126e945365))
returns1
(true
) if A
is a string array and A
has only one element. Otherwise, it returns0
(false
).
Examples
Create different arrays, and then determine if they are string scalars.
Test a string scalar.
Test a string array with multiple elements. Since str
contains more than one element, isStringScalar
returns 0
.
str = ["Mercury","Gemini","Apollo"]
str = 1×3 string "Mercury" "Gemini" "Apollo"
Test a character vector. Since character vectors are not strings, isStringScalar
returns 0
.
Input Arguments
Input array, specified as an array of any size and data type.
Version History
Introduced in R2017b