Main Content

setDefaultConfigurationName

Class: Simulink.VariantConfigurationData
Namespace: Simulink

(To be removed) Set name of the default variant configuration for a variant configuration data object

setDefaultConfigurationName will be removed in a future release. For more information, see Version History.

Syntax

vcdataObj.setDefaultConfigurationName(nameOfConfiguration)

Description

vcdataObj.setDefaultConfigurationName(nameOfConfiguration) sets the default configuration name for vcdataObj, which is an object of the Simulink.VariantConfigurationData class. vcdataObj must contain a variant configuration named nameOfConfiguration. If an empty value is passed, then the default configuration name is cleared.

Note

Setting a default variant configuration for a variant configuration data object is not recommended. Activate and validate the model using a specific variant configuration instead. If you set a default configuration, compiling or simulating the model will apply the default configuration irrespective of the variant control variable values in the global workspace.

Input Arguments

expand all

Name of configuration that must be set as default, specified as a character vector or string.

Example: "LinInterExpNoNoise"

Data Types: char | string

Examples

% Define the variant configuration data object
vcdataObj = Simulink.VariantConfigurationData;
  
% Add the LinInterExp variant configuration
vcdataObj.addConfiguration('LinInterExp',...
  'Linear Internal Experimental Plant Controller');
  
% Set the configuration LinInterExp as default
vcdataObj.setDefaultConfigurationName('LinInterExp');

% Obtain the default variant configuration
dconfig = vcdataObj.getDefaultConfiguration

Version History

Introduced in R2013b

collapse all

R2022b: setDefaultConfigurationName will be removed

The setDefaultConfigurationName method will be removed in a future release. Scripts which use this method continue to work with a warning.

Setting a default variant configuration for a variant configuration data object is not recommended. If the variant configuration data object associated with your model has an existing default configuration, you can convert it to the preferred variant configuration using the convertDefaultToPreferred method.