Main Content


Generate and reuse code for subsystems

Design and configure a model to control the code that the code generator produces for its subsystems. For more information, see Control Generation of Functions for Subsystems.


Subsystems and Code Generation

Control Generation of Functions for Subsystems

Control generation of functions for subsystems and whether the code generator stores the generated functions in memory sections.

Generate Code and Executables for Individual Subsystems

Describes how to generate and build a standalone executable from a subsystem.

Generate Subsystem Code as Separate Function and Files

To generate a separate subsystem function and a separate file for a subsystem in a model:

Code Generation of Constant Parameters

The code generator attempts to generate constant parameters to the shared utilities folder first.

Modeling Guidelines for Subsystems

When you develop models and generate code for subsystems, use the modeling guideline recommendations.

Code Optimization

Inline Subsystem Code

You can configure a nonvirtual subsystem to inline the subsystem code with the model code.

Optimize Code for Identical Nested Subsystems

The Function packaging parameter Auto option can optimize code in situations in which identical subsystems contain other identical subsystems, by both reusing and inlining generated code.