This example shows how to use the Simulink.VariantConfigurationAnalysis object 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.
You can provide either a list of named variant configurations or the variable groups to the creation function for the Simulink.VariantConfigurationAnalysis object. The operation returns a variant configuration analysis object for the model.
varConfigObjNamedConfig =
VariantConfigurationAnalysis with properties:
ModelName: 'slexVariantConfigurationAnalysis'
Configurations: {'VendorACtrlFuzzy' 'VendorACtrlLinear' 'VendorACtrlNonLinear'}
You can use the variant configuration analysis object to analyze the variant configurations using different functions specified in the following steps. This example analyzes the named configurations.
Get the list of active blocks in the variant configuration VendorACtrlLinear.
Get the list of blocks that are always active across all the named variant configurations that have been analyzed.
Get the list of blocks that are active in some of the analyzed variant configurations and inactive in other configurations.
Get the list of dependent libraries for a variant configuration.
Get the list of dependent models for a variant configuration.
Get the list of blocks that are inactive in all the named variant configurations that have been analyzed.
Get the variant condition on a block in a named variant configuration.
Show the variant configuration analysis report for a model after analyzing it.
Hide the variant configuration analysis report for a model after analyzing it.
Alternatively, use this syntax to specify a list of variable groups to analyze. You can use the variant configuration analysis object functions to analyze the configurations represented by these variable groups.