Skip to Main Content Skip to Search
Product Documentation

Selecting the Active Variant

What Is an Active Variant?

The active variant is the variant Simulink uses when simulating your model. An active variant can be either:

You control variants by setting conditions. Simulink determines the active variant by which variant object condition evaluates to true at compile time.

Selecting the Active Variant for Simulation

You select the active variant in the same way for variant models or variant subsystems.

You can switch the active variant by:

The condition of the variant objects determine which variant is active. You define the condition using variant control variables or parameters defined in the base workspace, so you can modify the values of the variant control variables to select the active variant. See Creating Control Variables.

You can also override the variant conditions and manually select one active variant. For instructions, see Overriding Variant Conditions.

Checking and Opening the Active Variant

When you open a model, variant blocks display the name of the variant that was active the last time the model was saved.

When the active variant changes (for example, when you change the control variables for variant conditions), the variant block name does not update until you select Edit > Update Diagram.

You can use the Variant menu to open the active variant. Right-click the block or select Edit > Variant > Open > (active variant)

To find the name of the active variant for the currently selected block, enter at the command line:

get_param(gcb, 'ActiveVariant')

Overriding Variant Conditions

You can specify one variant as the active variant. You can either:

In both the Model Variants and Variant Subsystem block parameters dialog boxes, use the Override variant conditions and use following variant parameter, at the bottom left.

  1. Select the parameter Override variant conditions and use following variant. The Variant parameter becomes enabled.

  2. Click the Variant drop-down list and select a variant object from the list. In the Model Variants block, the list shows each variant and the associated model name.

    In the Variant Subsystem block, the list shows only variant object names. Check the variant choices table for the name of the subsystem associated with each variant.

  3. After you make the change, click Apply or OK. The variant object that you specified becomes the active variant, overriding all other specifications that determine which variant is active. The variant remains active until you either select a different variant from the drop-down list, or clear Override variant conditions and use following variant.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS