Main Content
Structured Text Code Generation for Subsystem Reference Blocks
This example shows how to autogenerate structured text code for subsystem reference blocks.
Open Simulink Model
To open the Simulink test bench model, use the following command.
open_system('mSubSysRefSystemIntegration');
Generate Code for the Subsystem
To generate code for the subsystem use plcgeneratecode
generatedfiles = plcgeneratecode('mSubSysRefSystemIntegration/TopSystem');
### Generating PLC code for 'mSubSysRefSystemIntegration/TopSystem'. ### Using model settings from 'mSubSysRefSystemIntegration' for PLC code generation parameters. ### Begin code generation for IDE codesys23. ### Emit PLC code to file. ### Creating PLC code generation report mSubSysRefSystemIntegration_codegen_rpt.html. ### PLC code generation successful for 'mSubSysRefSystemIntegration/TopSystem'. ### Generated files: plcsrc/mSubSysRefSystemIntegration.exp