Main Content

tostring

Convert value to string

Description

str = tostring(X) converts numeric, Boolean, or enumerated data X to a string.

example

Note

The operator tostring is supported only in Stateflow® charts that use C as the action language. In charts that use MATLAB® as the action language, use string.

Examples

expand all

Convert numeric value to string "1.2345".

str = tostring(1.2345);

Stateflow chart that uses the tostring operator in a state.

Convert Boolean value to string "true".

str = tostring(true);

Stateflow chart that uses the tostring operator in a state.

Convert enumerated value to string "RED".

str = tostring(RED);

Stateflow chart that uses the tostring operator in a state.

Version History

Introduced in R2018b