Main Content

addChoice

Add variant choices to variant component

Description

example

compList = addChoice(variantComponent,choices) creates variant choices specified in choices in the specified variant component and returns their handles.

compList = addChoice(variantComponent,choices,labels) creates variant choices specified in choices with labels labels in the specified variant component and returns their handles.

Examples

collapse all

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

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

Input Arguments

collapse all

Variant component where variant choices are added, specified as a systemcomposer.arch.VariantComponent object.

Variant choice names, specified as a cell array of character vectors. The length of choices must be the same as labels.

Data Types: char

Variant choice labels, specified as a cell array of character vectors. The length of labels must be the same as choices.

Data Types: char

Output Arguments

collapse all

Created components, returned as an array of systemcomposer.arch.Component objects. This array is the same size as choices and labels.

More About

collapse all

Definitions

TermDefinitionApplicationMore Information
variantA variant is one of many structural or behavioral choices in a variant component.Use variants to quickly swap different architectural designs for a component while performing analysis.Create Variants
variant controlA variant control is a string that controls the active variant choice.Set the variant control to programmatically control which variant is active.Set Condition

Introduced in R2019a