Main Content

Initialize Function

Executes contents on a model initialize event

  • Library:
  • Simulink / User-Defined Functions

  • Initialize Function block


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.

Conditionally executed subsystem blocks with output ports fully supported within Terminate Function blocks

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.

Block Characteristics

Data Types

Boolean[a] | bus[a] | double[a] | enumerated[a] | fixed point[a] | half[a] | integer[a] | single[a] | string[a]

Direct Feedthrough


Multidimensional Signals


Variable-Size Signals


Zero-Crossing Detection


[a] Actual data type or capability support depends on block implementation.

Extended Capabilities