Customize C Functions Generated from Simulink Functions
When you generate C code from your model, each Simulink Function block corresponds to a function in the generated code. The return value of the function and its input arguments are used to represent the Argument Inport blocks and Argument Outport blocks of the Simulink function. The function body is the implementation of the Simulink function logic. You can customize these generated functions by configuring the model before generating code. Several tools are used for configuring the model, and the appropriate tool depends on the type of Simulink function and on the customized feature.
You can customize naming rules used for creating generated function names. For some Simulink function types, you can customize individual function names.
You can customize naming rules used for creating argument-related identifiers. Depending on the type of Simulink function, you might be able to customize individual argument identifiers.
For some types of Simulink functions you can customize additional argument-related aspects, as explained in each subsection. These aspects can include argument order, argument properties (such as parameter qualifiers of the arguments), and the parameter passing mechanism of arguments (such as having them passed by reference or by value to the function).
The type of a Simulink function depends on the value of the Function visibility parameter of its Trigger block and on its location in the model.
Customize C Functions Generated from Global Simulink Function Blocks
A global Simulink function is a Simulink Function blocks with the
Function visibility parameter of its Trigger
block specified as global. A global Simulink Function
block can be located anywhere in the model hierarchy, and it is callable from anywhere
in the model (both up and down the hierarchy).
Each of these examples provides a step-by-step description about customizing C functions generated from global Simulink Function blocks:
Customize C Functions Generated from Scoped Simulink Function Blocks Located in Top Models
A scoped Simulink function is a Simulink Function blocks with the
Function visibility parameter of its Trigger
block specified as scoped. When a scoped Simulink® function is located at the top model, it is
callable from any function generated from the model.
Each of these examples provides a step-by-step description about customizing C functions generated from scoped Simulink Function blocks located in the top model:
Customize C Functions Generated from Scoped Simulink Function Blocks Located in Subsystems
A scoped Simulink function is a Simulink Function blocks with the
Function visibility parameter of its Trigger
block specified as scoped. When a scoped Simulink function is located in a subsystem, it is
callable from any function in the same subsystem or inside a subsystem in its
hierarchy.
Each of these examples provides a step-by-step description about customizing C functions generated from scoped Simulink Function blocks located in subsystems:
See Also
Simulink Function | Argument Inport | Argument Outport | Trigger | Function visibility