Main Content

getVariantCondition

Class: Simulink.VariantConfigurationAnalysis
Package: Simulink

Variant condition on a block in a named variant configuration

Syntax

variantCondition = varConfigObj.getVariantCondition(configName,blockName)

Description

Use this method to find the variant condition on a block 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 getVariantCondition method.

Note

This method requires Variant Manager for Simulink®.

variantCondition = varConfigObj.getVariantCondition(configName,blockName), returns the variant condition on the block blockName in the named variant configuration configName. varConfigObj is the VariantConfigurationAnalysis object for a model.

Input Arguments

expand all

Name of the variant configuration, specified as a character vector. You must analyze this configuration using the Simulink.VariantConfigurationAnalysis class first.

Name of the block for which you want to find the variant condition, specified as character vector of block path.

Output Arguments

expand all

Variant condition on the block in the given variant configuration, returned as cell array.

Examples

% Add model to path
addpath(fullfile(matlabroot,'examples','simulink_variants','main'));

% Open model
open_system('slexVariantManagement'); 

% Get variant configuration analysis object
varConfigObj = Simulink.VariantConfigurationAnalysis('slexVariantManagement',...
'NamedConfigurations', {'LinInterStd','NonLinExterLowFid', 'NonLinExterHighFid'})

% Get variant condition 
VariantCondition = varConfigObj.getVariantCondition('NonLinExterLowFid',...
'slexVariantManagement/Controller/Linear Controller')

Version History

Introduced in R2019b