Represent model or subsystem as generated S-function code
Simulink Coder / S-Function Target
An instance of the Generated S-Function block represents code that the code generator produces from its S-function system target file for a model or subsystem. For example, you extract a subsystem from a model and build a Generated S-Function block from it by using the S-function target. This mechanism can be useful for:
Converting models and subsystems to application components
Reusing models and subsystems
Optimizing simulation—often, an S-function simulates more efficiently than the original model
For details on how to create a Generated S-Function block from a subsystem, see Create S-Function Blocks from a Subsystem.
The S-Function block must perform identically to the model or subsystem from which it was generated.
Before creating the block, explicitly specify Inport block signal attributes, such as signal widths or sample times. The sole exception to this rule concerns sample times, as described in Sample Time Propagation in Generated S-Functions.
Set the solver parameters of the Generated S-Function block to be the same as the parameters of the original model or subsystem. The generated S-function code operates identically to the original subsystem (for an exception to this rule, see Choose a Solver Type).