Main Content

isstring

Determine if input is string

Description

example

tf = isstring(X) returns 1 (true) if X is a string. Otherwise, it returns 0 (false).

Note

The isstring operator is not supported in Stateflow® charts that use C as the action language.

Examples

expand all

Return a value of 1 (true) because the input argument "Hello, world!" is a string.

str = "Hello, world";
x = isstring(str);

Stateflow chart that uses the blanks operator in a state.

Return a value of 0 (false) because the input argument 9 is a not string.

u = 9;
y = isstring(u);

Stateflow chart that uses the blanks operator in a state.

Input Arguments

expand all

Input value, specified as a scalar, vector, matrix, or multidimensional array. X can be any data type. If X is a string, it must be a string scalar.

Version History

Introduced in R2021b