Main Content

Generate Subsystem Code as Separate Function and Files

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

  1. Right-click a Subsystem block. From the context menu, select Block Parameters (Subsystem).

  2. In the Subsystem Parameters dialog box, if the subsystem is virtual, select Treat as atomic unit. On the Code Generation tab, the Function packaging parameter is now available.

  3. Click the Code Generation tab and select Nonreusable function from the Function packaging parameter. The Nonreusable function option enables two parameters:

  4. Set the Function name options parameter.

  5. Set the File name options parameter to a value other than Auto. If you are generating a reusable function for your subsystem, see Generate Reentrant Code from Subsystems or Generate Reusable Code from Library Subsystems Shared Across Models.

  6. Click Apply and close the dialog box.

  7. Open the Configuration Parameters dialog box. Set the model configuration parameter File packaging format (Embedded Coder) to Modular.