Main Content

setPreferredConfiguration

Class: Simulink.VariantConfigurationData
Namespace: Simulink

Set name of preferred variant configuration for variant configuration data object

Since R2022b

Description

Note

This method requires Variant Manager for Simulink®.

example

vcdataObj.setPreferredConfiguration(nameOfConfiguration) sets the name of the preferred variant configuration for the Simulink.VariantConfigurationData object vcdataObj to nameOfConfiguration.

Input Arguments

expand all

Name of the preferred variant configuration, specified as a character vector or string.

Example: "LinInterExpNoNoise"

Data Types: char | string

Examples

expand all

Open the model slexVariantManagement.

model = 'slexVariantManagement';
open_system(model);

Get the variant configuration data object associated with the model.

vcdataobj = Simulink.VariantManager.getConfigurationData(model);

Set the name of the preferred variant configuration for the variant configuration data object.

vcdataobj.setPreferredConfiguration("LinInterExpNoNoise");

Apply the preferred variant configuration and compile the model.

Simulink.VariantManager.applyConfiguration(model, 'Configuration', vcdataobj.getPreferredConfiguration());
set_param(model, 'SimulationCommand', 'Update');

Version History

Introduced in R2022b