Initialize Function

Executes contents on a model initialize event

  • Library:
  • User-Defined Functions


The Initialize Function block is a pre-configured subsystem block that executes on a model initialize event. By default, the Initialize Function block includes an Event Listener block with Event set to Initialize, a Constant block with Constant value set to 0, and a State Writer block.

Replace the Constant block with blocks that generate the state value for the State Writer block.

For a list of unsupported blocks and features, see Initialize, Reset, and Terminate Function Limitations.

The input and output ports of a component containing Initialize Function and Terminate Function blocks must connect to input and output port blocks.

The code generated from this block is part of the model_initialize function that is called once at the beginning of model execution.

Was this topic helpful?