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');
arch = get(model,'Architecture');
variant = addVariantComponent(arch,'Component1');
compList = addChoice(variant,{'Choice1','Choice2'});

Input Arguments

collapse all

Architecture 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.

Introduced in R2019a