This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To String

Convert input signal to string signal

  • Library:
  • Simulink / String


The To String block creates a string signal from an input signal. For example, consider using this signal to convert a logical value 1 or 0 to its string equivalent "false" or "true".

When a MinGW® compiler compiles code generated from the block, running the compiled code may produce nonstandard results for floating-point inputs. For example, a numeric input of 501.987 returns the string "5.019870e+002" instead of the expected string "5.019870e+02".



expand all

Input signal, specified as a scalar.


expand all

Output string, specified as a scalar. This block returns the output as a string, surrounded by double quotes.

  • If the input is a Boolean, the output is a logical value (1 or 0) and the block returns its textual equivalent (true or false).

  • If the input is a numeric data type, such as an integer, single, double, or fixed point, the block returns the number as a string. For example, an input of 1 converts to "1" and an input of 0 converts to "0".


    The output string might not contain all the digits of the numeric value from the input port.

Data Types: string

Block Characteristics

Data Types

Boolean | double | enumerated | fixed point | integer | single | string

Direct Feedthrough


Multidimensional Signals


Variable-Size Signals


Zero-Crossing Detection


Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Convert floating-point algorithms to fixed point using Fixed-Point Designer™.

Introduced in R2018a