Main Content

addChoice

Add variant choices to variant component

Description

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.

example

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

Version History

Introduced in R2019a