Adding Input String Values (Text Block) in Simulink

Simulink cannot send texts (or string values) between two blocks: only numerical values are permitted.

Note: The plugin is available under the Ansys AVxcelerate Headlamp Add-on (Smart Headlamp) or Real-Time Camera license.
Note: To send texts, Simulink allows you to define a text block using Input String Values. Each character of a text must be converted to a number.

In that way, a text is a vector a integer numbers (their value is equal to the ASCII one). Thus, « Hello world » is sent as the vector « 72 101 108 108 111 32 119 111 114 108 100 » between two Simulink blocks, where H = 72 ; e = 101 ; etc.

To Define a Text Block in Simulink:

  1. Insert a Constant block inside your model.
  2. Double-click the Constant block to open its parameters.
  3. In the Main tab,
    1. Replace its Constant value by uint8(‘Your text here’).
    2. Replace Your text here by the text you want to send to another block.
  4. Deselect Interpret vector parameters as 1-D to increase the compatibility with Ansys AVxcelerate Lighting and Sensors library blocks and simplify the management of your text through your model.
  5. In the Signal Attributes tab, set Output data type to uint8.
  6. Click OK.

The text block is defined.