Simulink.VariantManager.generateConfigurations
Syntax
Description
[
generates variant configurations for the given model vcdo,configsInfo] = Simulink.VariantManager.generateConfigurations(modelName,Name=Value)modelName as
specified by one or more optional name-value arguments.
If Precondition
argument is specified and the AddPreconditionAsConstraint argument is set to true, the
corresponding condition is defined as a global constraint in the output object
vcdo. The optional configsInfo output contains
information on the validity of the generated configurations.
Note
To use this function, you must install the Variant Manager for Simulink® support package.
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Limitations
The auto-generation process supports only
==,~=,&&,||, and~operators in the variant control expressions of variant blocks and in the preconditions. If the variant control expressions use other operators such as arithmetic or relational operators, the configurations that can activate those variant choices might not get generated.The process does not support generating variant configurations for these modeling elements:
Models that contain variant blocks that use variant control variables defined in the mask or model workspace
Variant parameters (
Simulink.VariantVariableobjects) defined in the model workspaceVariant blocks with a Variant control expression that contains noninteger double values, structure fields, or
Simulink.Parameterobjects with value set to an expression of typeslexprModels that represent a library or subsystem
For variant blocks with the Variant control mode parameter set to
label, the variant control labels are strings, not variables. Hence they are not present in the generated configurations.For Variant Subsystem blocks, these conditions also apply:
If the Variant control mode parameter is set to
label, only the variations present in the active label path are considered when you generate configurations.Consider this model hierarchy for a model with a Variant Subsystem block in
labelmode. The active choice for the variant subsystem is the Subsystem block, which has its variant control set to a label,SUB1. The variant control variableAis used by the active choice and is considered when you generate configurations. The process does not consider the control variableBbecause it is in the inactive choice of the variant subsystem.
Here is the list of all generated configurations.

If the Variant control mode parameter is set to
sim codegen switching, only the variations present in thesimchoice are considered when you generate configurations. For the variant controls present in thecodegenhierarchy, only the default values are included in the generated configurations.Consider this model hierarchy for a model with a Variant Subsystem block in
sim codegen switchingmode. Thesimchoice for the variant subsystem is the Subsystem block. The variant control variableBpresent in this choice is considered when you generate configurations. The process only considers the default value for the control variableCbecause it is in thecodegenchoice of the variant subsystem.
Here is the list of all generated configurations.

If the Variant activation time is set to
update diagram, only the variations in the active choice are considered for generating configurations.
Tips
You can use the intersect, setdiff,
union, and unique methods in the
Simulink.VariantConfigurationData class to perform set operations on variant
configuration data objects. See Object Functions.
Version History
Introduced in R2022b