Main Content

Generated S-Function

Represent model or subsystem as generated S-function code

  • Library:
  • Simulink Coder / S-Function Target

  • Generated S-Function block


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).



expand all

See requirements.

Output Arguments

expand all

See requirements.


expand all

The name of the generated S-function. The code generator derives the name by appending _sf to the name of the model or subsystem from which the block is generated.

If selected, displays modules generated for the S-function.

Introduced in R2011b