Main Content

string

Convert value to string

Description

example

str = string(X) converts the input X to a string. Use this operator in the Requirements Table block.

Examples

expand all

Convert Boolean value to string "true".

str = string(true);

Stateflow chart that uses the tostring operator in a state.

In a Requirements Table block, create a requirement that converts the number 3145 into a string.

y = string(3145)

This image shows a requirement that outputs a string by using an integer 3145.

Input Arguments

expand all

Input value, specified as a scalar.

If X is a numerical data type, it must be an integer. For example, A can equal 25, but cannot equal 2.5.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | string
Complex Number Support: Yes

Output Arguments

expand all

Output string, returned as a string scalar.

Version History

Introduced in R2022b

See Also