Main Content


Set condition on variant choice



setCondition(variantComponent,choice,expression) sets the variant control for a choice for the variant component.


collapse all

Create a model, get the root architecture, create one variant component, add two choices for the variant component, set the active choice, and set a condition.

model = systemcomposer.createModel('archModel');
arch = get(model,'Architecture');
mode = 1;
variant = addVariantComponent(arch,'Component1');
compList = addChoice(variant,{'Choice1','Choice2'});
setCondition(variant,compList(2),'mode == 2');

Input Arguments

collapse all

Architecture component, specified as a systemcomposer.arch.VariantComponent object. This component contains multiple choices.

Choice in variant component whose control string is set by this function, specified by a systemcomposer.arch.Component object.

Control string that controls the selection of choice, specified as a character vector.

Data Types: char

Introduced in R2019a