Main Content

getComponentConfigurationName

Class: Simulink.VariantConfigurationData
Namespace: Simulink

Get name of variant configuration used by referenced component

Since R2023b

Description

Consider a model that has predefined variant configurations and also has a referenced model in its model hierarchy. The referenced model defines its own variant configurations. While authoring the variant configurations for the top-level model, you might associate a referenced model configuration with a top-level variant configuration to populate the corresponding control variables in the top-level configuration. Use the getComponentConfigurationName method to get the name of the referenced model configuration used within a top-level variant configuration. For more information on the workflow, see Compose Variant Configurations for Top Model Using Referenced Model Configurations.

Note

This method requires Variant Manager for Simulink®.

refConfigName = vcdTop.getComponentConfigurationName (ConfigurationName=topmdlConfig,ComponentName=refmdlName) returns the name of the variant configuration used by the referenced component refmdlName in the top-level model variant configuration topmdlConfig. The variant configuration topmdlConfig must be defined in vcdTop, which is an object of the Simulink.VariantConfigurationData class and represents the variant configuration data object associated with the top-level model.

example

Input Arguments

expand all

Variant configuration data object of the top-level model, specified as a VariantConfigurationData object.

Name of the variant configuration of top-level model from which the configuration used by the referenced component refmdlName must be retrieved, specified as a character vector or string. topmdlConfig must be defined in vcdTop.

Example: 'LinExterHighFid'

Data Types: char | string

Name of a referenced component, such as a referenced model, in the model hierarchy of the top-level model, specified as a character vector or string.

Example: 'slexVariantManagementExternalPlantMdlRef'

Data Types: char | string

Output Arguments

expand all

Name of variant configuration used by referenced component, returned as a character vector or string.

Examples

expand all

In this example, LinExterHighFid is a variant configuration defined for the top-level model slexVariantManagement and is present in the variant configuration data object vcd. To get the name of the variant configuration used by the referenced component slexVariantManagementExternalPlantMdlRef in the variant configuration LinExterHighFid:

modelName = 'slexVariantManagement';
openExample(modelName);
vcd = Simulink.VariantManager.getConfigurationData(modelName);
refSelectedConfig = vcd.getComponentConfigurationName...
(ConfigurationName='LinExterHighFid',ComponentName='slexVariantManagementExternalPlantMdlRef');

Version History

Introduced in R2023b