Main Content

Variant Hierarchical Components

Implement structural variations in a separate hierarchy

With hierarchical variant blocks, you can represent all design alternatives of a system in a single model. Each design choice is incorporated into the model as a variant choice in a separate hierarchy. Such models have a fixed common structure and a finite set of variable components that are activated or deactivated depending on the variant controls.

For example, suppose you want to simulate a model that represents a vehicle with three possible engine configurations: 4-cylinder gas, 6-cylinder gas, and 8-cylinder gas. You can implement each engine model as a separate subsystem inside the Variant Subsystem, Variant Model, Variant Assembly Subsystem block and then switch between the subsystems based on the variant controls you select. For more information, see Introduction to Variant Controls.

The code that you generate for the hierarchical variant blocks can contain all the variant choices of a system. You can switch between the choices prior to code compile or at model startup as described in Activate Variant During Different Stages of Simulation and Code Generation Workflow. For information on generating code with hierarchical variant blocks, see Represent Subsystem and Variant Models in Generated Code (Embedded Coder).


Variant Subsystem, Variant Model, Variant Assembly SubsystemTemplate subsystem containing Subsystem, Model, or Subsystem Reference blocks as variant choices


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



Convert Configurable Subsystem to Variant Subsystem

Learn how to convert configurable subsystems to variant subsystems and their behavior on loading.

Convert Variant Subsystem to Variant Assembly Subsystem

Steps to convert Variant Subsystem block to Variant Assembly Subsystem block.

Transform Model to Variant System (Simulink Check)

Use the Model Transformer tool to transform a model into a variant system.