Main Content

string

Convert value to string

Description

example

str = string(X) converts the input X to a string.

Note

The operator string is not supported in Stateflow® charts that use C as the action language. For similar functionality, use tostring.

Examples

expand all

Convert integer scalar to string "1307".

str = string(1307);

Stateflow chart that uses the string operator in a state.

Convert Boolean value to string "true".

str = string(true);

Stateflow chart that uses the tostring operator in a state.

Input Arguments

expand all

Input value, specified as a integer scalar, Boolean scalar, or character array. To create a character array of spaces, use the operator blanks.

Example: str = string(1307)

Example: str = string(true)

Example: str = string(blanks(n))

Version History

Introduced in R2021b