Variant Event-Based Components
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.
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).
Blocks
Initialize Function | Execute subsystem on model initialize event |
Reset Function | Execute subsystem on model reset event |
Terminate Function | Execute subsystem on model terminate event |
Simulink Function | Graphically define a function with Simulink blocks |
Classes
Simulink.VariantControl | Create a variant control variable object (Since R2021a) |
Simulink.Parameter | Store, share, and configure parameter values |
Simulink.Variant | Specify conditions that control variant selection |
Functions
enumeration | Class enumeration members and names |
Objects
struct | Structure array |
Topics
- Conditionally Execute Custom Initialize, Reinitialize, Reset, and Terminate Routines
The custom routine blocks(Initialize Function, Reinitialize Function, Reset Function, and Terminate Function) blocks are preconfigured subsystem blocks that enable you to add custom routines to the default initialize, reset, and terminate routines to change or read block states.
- Conditionally Execute Simulink Functions
With variant blocks, you can conditionalize functions defined using Simulink Function blocks.