You can group blocks into a Subsystem block to reduce the size and complexity of a model. To generate modular code and unit test code for individual subsystems, you can configure an atomic subsystem to generate code to a separate function and file.
A subsystem can be virtual or atomic. A virtual subsystem provides graphical hierarchy in a model and does not impact the execution of a model. An atomic subsystem executes as a single unit within a model. The code generator supports conditionally executed subsystems.
- Generate Code and Executables for Individual Subsystems
Generate and build a standalone executable from a subsystem.
- Generate Subsystem Code as Separate Function and Files
Configure subsystems to generate functions in separate files and specify the names of those functions and files.
- Generate Inlined Subsystem Code
Configure nonvirtual subsystems to generate inlined code.
- Function Reuse in Generated Code
This example shows how to configure an atomic subsystem for generating reusable code.
- Determine Why Subsystem Code Is Not Reused
Determine why the code generator does not reuse subsystem code as you expect.
- Generate Reusable Code from Model Reference Hierarchy
Generate reusable subsystem code from a top model with Model blocks.
- Generate Reentrant Code from Subsystems
Generate reusable, reentrant code from subsystems.
- Generate Reusable Code from For Each Subsystems
Generate reusable code for For Each subsystems that perfom the same processing.