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:
- Insert a Constant block inside your model.
- Double-click the Constant block to open its parameters.
-
In the Main tab,
- Replace its Constant value by uint8(‘Your text here’).
- Replace Your text here by the text you want to send to another block.
- 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.
- In the Signal Attributes tab, set Output data type to uint8.
- Click OK.
The text block is defined.