Generated Code Structure for MATLAB Function Block
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.
plcdemo_eml_tankcontrolmodel. To open the model, enter:
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
If you do not have the
plcdemo_eml_tankcontrol.expfile 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
Examine the generated Structured Text code.