Main Content

Variant Event-Based Components

Execute initialize, reset ,and terminate events and Simulink functions conditionally

You can activate or deactivate the execution of subsystems on a model initialize, reset, and terminate events depending on the variant control you select. You can also execute Simulink® functions conditionally. For more information, see Variant Condition Propagation with Variant Sources and Sinks.

The code that you generate for event-based variant blocks can contain all the variant choices of a system. You can switch between the choices prior to code compile. For information on generating code with event-based variant blocks, see Represent Subsystem and Variant Models in Generated Code (Embedded Coder).


Initialize FunctionExecute subsystem on model initialize event
Reset FunctionExecute subsystem on model reset event
Terminate FunctionExecute subsystem on model terminate event
Simulink FunctionGraphically define a function with Simulink blocks


Simulink.VariantControlCreate a variant control variable object
Simulink.ParameterStore, share, and configure parameter values
Simulink.VariantSpecify conditions that control variant selection


enumerationClass enumeration members and names


structStructure array