Main Content

getActiveChoice

Get active choice on variant component

Description

example

choice = getActiveChoice(variantComponent) finds which choice is active for the variant component.

Examples

collapse all

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

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

  Component with properties:

     IsAdapterComponent: 0
           Architecture: [1×1 systemcomposer.arch.Architecture]
                   Name: 'Choice2'
                 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: 85.0006
    SimulinkModelHandle: 78.0002
                   UUID: '23b62204-f0e2-48a2-8bd6-4689f003def4'
            ExternalUID: ''

Input Arguments

collapse all

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

Output Arguments

collapse all

Handle of chosen variant, returned as a systemcomposer.arch.Component object.

Introduced in R2019a