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");
systemcomposer.openModel("archModel");
arch = get(model,"Architecture");
variant = addVariantComponent(arch,"Component1");
compList = addChoice(variant,["Choice1","Choice2"]);

Input Arguments

collapse all

Variant component, specified as a systemcomposer.arch.VariantComponent object.

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

Data Types: char | string

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

Data Types: char | string

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
variant

A 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 control

A variant control is a string that controls the active variant choice.

Set the variant control programmatically to control which variant is active.

Set Variant Control Condition

Version History

Introduced in R2019a