Main Content

Simulink.VariantManager.applyConfiguration

Class: Simulink.VariantManager
Package: Simulink

Apply specified variant configuration to model

Since R2022b

Description

Note

This method requires Variant Manager for Simulink®.

example

Simulink.VariantManager.applyConfiguration(model,Configuration=configname) applies the variant configuration specified by configname to the model model and any referenced components in the model hierarchy.

The variant configuration named configname must be present in the VariantConfigurationData object associated with model. The operation exports the variant control variables defined in the specified configuration to the base workspace or data dictionary used by the model.

This method allows you to quickly switch the variant configuration for a model. The method does not validate the configuration. To validate and activate a model using a specific configuration or using the currently applied configuration, use the Simulink.VariantManager.activateModel method.

Input Arguments

expand all

Name of the model to which the specified variant configuration must be applied, specified as a character vector or string.

Example: "slexVariantManagement"

Data Types: char | string

Name of the variant configuration that must be applied to the model, specified as a character vector or string.

Example: "Config1"

Data Types: char | string

Examples

expand all

Open the model slexVariantManagement.

model='slexVariantManagement';
open_system(model);

The model has multiple named variant configurations stored in the variant configuration data object vcd associated with the model.

Apply the configuration LinInterExpNoNoise to the model.

Simulink.VariantManager.applyConfiguration(model,Configuration="LinInterExpNoNoise");

Version History

Introduced in R2022b