Main Content
Generate Structured Text Code for a Simple Simulink Subsystem
This example shows how to select the target IDE for a Simulink® model, generate IEC 61131-10 code, and view generated files.
1. Open model plcdemo_simple_subsystem
and save a copy to a writable location.
2. Open the Simulink PLC Coder app.
3. Open the PLC Code Generation dialog box.. In the Target IDE select OMRON Sysmac Studio - IEC61131-0 XML.
Click OK.
4. Select the SimpleSubsystem
block and click Generate PLC Code. Alternatively, from the command line, enter:
generatedfiles = plcgeneratecode('plcdemo_simple_subsystem/SimpleSubsystem');
5. View the code generation report.
The report includes links to the generated code file plcdemo_simple_subsystem.exp
and associated traceability and code metrics reports.
6. This figure contains the generated code plcdemo_simple_subsystem.exp
.