Main Content


Get available choices in variant component



compList = getChoices(variantComponent) returns the list of choices available for a variant component.


collapse all

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

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

  Component with properties:

     IsAdapterComponent: 0
           Architecture: [1×1 systemcomposer.arch.Architecture]
                   Name: 'Choice1'
                 Parent: [1×1 systemcomposer.arch.Architecture]
                  Ports: [0×0 systemcomposer.arch.ComponentPort]
             OwnedPorts: [0×0 systemcomposer.arch.ComponentPort]
      OwnedArchitecture: [1×1 systemcomposer.arch.Architecture]
               Position: [15 15 65 65]
                  Model: [1×1 systemcomposer.arch.Model]
         SimulinkHandle: 99.0010
    SimulinkModelHandle: 94.0002
                   UUID: '533d7f63-41e2-40fd-afe8-d081729849f0'
            ExternalUID: ''

Input Arguments

collapse all

Variant component, specified as a systemcomposer.arch.VariantComponent object with multiple choices.

Output Arguments

collapse all

Choices available for variant component, returned as an array of systemcomposer.arch.Component objects.

More About

collapse all


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