To generate a separate subsystem function and a separate file for a subsystem in a model:
Right-click aSubsystemblock. From the context menu, selectBlock Parameters (Subsystem).
In the Subsystem Parameters dialog box, if the subsystem is virtual, selectTreat as atomic unit. On theCode Generationtab, theFunction packagingparameter is now available.
Click theCode Generationtab and selectNonreusable function
from theFunction packagingparameter. TheNonreusable function
option enables two parameters:
TheFunction name options(Simulink) parameter controls the naming of the generated function.
TheFile name options(Simulink) parameter controls the naming of the generated file.
Set theFunction name optionsparameter.
Set theFile name optionsparameter to a value other thanAuto
. If you are generating a reusable function for your subsystem, seeGenerate Reentrant Code from SubsystemsorGenerate Reusable Code from Library Subsystems Shared Across Models.
ClickApplyand close the dialog box.