This topic assumes that you have generated Structured Text code from a Simulink® model. If you have not yet done so, see Generate Structured Text from the Model Window.
The example in this topic shows generated code for the CoDeSys Version 2.3 IDE. Generated code for other IDE platforms looks different.
Open the plcdemo_eml_tankcontrol
model.
Open the PLC Coder app. Click the PLC Code tab.
Click Generate PLC Code.
The Simulink
PLC Coder™ software generates Structured Text code and places it in
.current_folder
/plcsrc/plcdemo_eml_tankcontrol.exp
If you do not have the plcdemo_eml_tankcontrol.exp
file
open, open it in the MATLAB® editor.
The following figure illustrates the mapping of the generated code to
Structured Text components for a Simulink Subsystem block that contains a MATLAB Function
block. The coder tries to perform inline optimization on the generated code for
MATLAB local functions. If the coder determines that it is more efficient
to leave the local function as is, it places the generated code in a Structured
Text construct called FUNCTION
.
Examine the generated Structured Text code.