Main Content

Terminate Function

Execute subsystem on model terminate event

  • Library:
  • Simulink / User-Defined Functions

  • Terminate Function block


The Terminate Function block is a pre-configured subsystem block that executes on a model terminate event. By default, the Terminate Function block includes:

Customize the contents of the Terminate Function block by, for example, specifying a State owner block for the State Reader block and replacing the Terminator block with blocks to save the state value from the State Reader block.

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

For a list of unsupported blocks and features, see Initialize, Reinitialize, 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_terminate function that is called once at the end of model execution.

You can select an Initialize Function, Reinitialize Function, Reset Function, or Terminate Function block or a corresponding state owner block to highlight blocks related to it. To show a related block in an open diagram or new tab, pause on the ellipsis that appears after selection. Then, select Related Blocks Related Blocks button from the action bar. When multiple blocks correspond to the selected block, a list of related blocks opens. You can filter the list of related blocks by entering a search term in the text box. After you select a related block from the list, window focus goes to the open diagram or new tab that shows the related block.

Block Characteristics

Data Types

Booleana | busa | doublea | enumerateda | fixed pointa | halfa | integera | singlea | stringa

Direct Feedthrough


Multidimensional Signals


Variable-Size Signals


Zero-Crossing Detection


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

Extended Capabilities