Main Content

getDependentLibraries

Class: Simulink.VariantConfigurationAnalysis
Namespace: Simulink

List of libraries that are used in a named variant configuration

Description

Use this method to find the libraries used in a named variant configuration after analyzing it using the Simulink.VariantConfigurationAnalysis class. You must create a variant configuration analysis object of type Simulink.VariantConfigurationAnalysis for a model and use it to analyze the required named variant configurations for that model before calling the getDependentLibraries method.

Note

This method requires Variant Manager for Simulink®.

dependentLibraries = varConfigObj.getDependentLibraries(configName) returns a list of libraries that are used in the variant configuration named configName. varConfigObj is the VariantConfigurationAnalysis object for a model.

example

Input Arguments

expand all

Name of the variant configuration for which you want to find the dependent libraries, specified as a character vector. You must analyze this configuration using the Simulink.VariantConfigurationAnalysis class first.

Output Arguments

expand all

List of dependent libraries, returned as a cell array.

Examples

expand all

This example shows how to use the Simulink.VariantConfigurationAnalysis class to analyze variant configurations programmatically.

To analyze variant configurations using Variant Manager, see Analyze Variant Configurations in Models Containing Variant Blocks.

Open the model slexVariantConfigurationAnalysis.

open_system('slexVariantConfigurationAnalysis'); 

You can provide either a list of named variant configurations or the variable groups to analyze to the Simulink.VariantConfigurationAnalysis class. The operation returns a variant configuration analysis object for the model.

varConfigObjNamedConfig = Simulink.VariantConfigurationAnalysis('slexVariantConfigurationAnalysis', ...
                           'NamedConfigurations', {'VendorACtrlLinear', ...
                           'VendorACtrlNonLinear', 'VendorACtrlFuzzy'})
varConfigObjNamedConfig = 
  VariantConfigurationAnalysis with properties:

         ModelName: 'slexVariantConfigurationAnalysis'
    Configurations: {'VendorACtrlFuzzy'  'VendorACtrlLinear'  'VendorACtrlNonLinear'}

varConfigObjVarGroup = Simulink.VariantConfigurationAnalysis('slexVariantConfigurationAnalysis',...
                          'VariableGroups', [struct('Name', 'VendorANonLinear',...
                          'VariantControls', {{'CONTROLLER', 1, 'EXTERNAL_SENSOR', 1, 'ORDER', 1, 'SATURATE', 1, 'VENDOR', 1}}),...
                           struct('Name', 'VendorALinear',...
                          'VariantControls', {{'CONTROLLER', 0, 'EXTERNAL_SENSOR', 1, 'ORDER', 1, 'SATURATE', 1, 'VENDOR', 1}})]);

You can use the variant configuration analysis object to analyze the variant configurations using different methods specified in the following steps.

Get the list of active blocks in the variant configuration VendorACtrlLinear.

activeblocks = varConfigObjNamedConfig.getActiveBlocks('VendorACtrlLinear');

Get the list of blocks that are always active across all the named variant configurations that have been analyzed.

alwaysActiveBlocks = varConfigObjNamedConfig.getAlwaysActiveBlocks();

Get the list of blocks that are active in some of the analyzed variant configurations and inactive in other configurations.

getBlockDifferences = varConfigObjNamedConfig.getBlockDifferences();

Get the list of dependent libraries for a variant configuration.

dependentLibraries = varConfigObjNamedConfig.getDependentLibraries('VendorACtrlNonLinear');

Get the list of dependent models for a variant configuration.

dependentModels = varConfigObjNamedConfig.getDependentModels('VendorACtrlFuzzy');

Get the list of blocks that are inactive in all the named variant configurations that have been analyzed.

neverActiveBlocks = varConfigObjNamedConfig.getNeverActiveBlocks();

Get the variant condition on a block in a named variant configuration.

variantCondition = varConfigObjNamedConfig.getVariantCondition('VendorACtrlNonLinear',...
'slexVariantConfigurationAnalysis/Controller/NonLinear');

Show the variant configuration analysis report for a model after analyzing it.

varConfigObjNamedConfig.showUI();

Hide the variant configuration analysis report for a model after analyzing it.

varConfigObjNamedConfig.hideUI();

Version History

Introduced in R2019a