Simulink.VariantConfigurationData class

Package: Simulink

Class representing a variant configurations data object

Description

The variant configuration data object, stores a collection of variant configurations, constraints, and the name of the default active configuration. The Simulink.VariantConfigurationData class has properties that enable you to add, modify, or remove variant configurations, constraints, and control variables. Use an instance of Simulink.VariantConfigurationData class to do the following:

  • Define and edit variant configurations.

  • Add control variables to variant configurations.

  • Add copy of variant configuration.

  • Delete existing variant configurations, constraints, and sub model configurations.

  • Set a specific configuration as default active.

  • Validate model using default or a specific variant configuration.

  • Query or create variant configurations data object for a given model.

Properties

VariantConfigurations

Set of variant configurations. The names of the configurations must be unique and valid MATLAB® variable names.

Constraints

Set of constraints that must always be satisfied by the model for all variant configurations. The name of the constraints must be unique and valid MATLAB variable names.

DefaultConfigurationName

Name of the variant configuration to be used by default for validation.

Methods

VariantConfigurationDataObject constructor with optional arguments for variant configurations, constraints, and default configuration name
addConfigurationAdd a new variant configuration to the variant configuration data object
addConstraintAdd a constraint to the variant configuration data object
addControlVariablesAdd control variables to an existing variant configuration
addCopyOfConfigurationAdd a copy of an existing variant configuration to the variant configuration data object
addSubModelConfigurationsAdd to a variant configuration the names of the configurations to be used for submodels
existsForCheck if variant configuration data object exists for a model
getConfiguration Returns the variant configuration with a given name from a variant configuration data object
getDefaultConfigurationReturns default variant configuration, if any, for a variant configuration data object
getForGet existing variant configuration data object for a model
getOrCreateForGet existing or create a new variant configuration data object for a model
removeConfigurationRemove a variant configuration with a given name from the variant configuration data object
removeConstraintRemove a constraint from the variant configuration data object
removeControlVariableRemove a control variable from a variant configuration
removeSubModelConfigurationRemove from a variant configuration, the configuration to be used for a sub model.
setDefaultConfigurationNameSet name of the default variant configuration for a variant configuration data object
validateModelActivate and validate all variant blocks in a model hierarchy

Examples

load_system(model);
% Create variant config and associate it with model
variantConfig = Simulink.VariantConfigurationData;
set_param(model, 'VariantConfigurationObject', 'variantConfig');