主要内容

本页采用了机器翻译。点击此处可查看英文原文。

getActiveChoice

获取变体组件的活动选择项

说明

choice = getActiveChoice(variantComponent) 查找变体组件的活动选择项。

示例

示例

全部折叠

创建一个模型,获取根架构,创建一个变体组件,为变体组件添加两个选择项,设置活动选择项,并获取活动选择项。

model = systemcomposer.createModel("archModel");
systemcomposer.openModel("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]
             Parameters: [0×0 systemcomposer.arch.Parameter]
               Position: [15 15 135 115]
                  Model: [1×1 systemcomposer.arch.Model]
         SimulinkHandle: 217.0010
    SimulinkModelHandle: 149.0007
                   UUID: 'a8f756a1-31f0-44d4-8690-63d13c0ae252'
            ExternalUID: ''

输入参数

全部折叠

变体组件,指定为 systemcomposer.arch.VariantComponent 对象。

输出参量

全部折叠

选择的变体,以 systemcomposer.arch.Component 对象的形式返回。

详细信息

全部折叠

版本历史记录

在 R2019a 中推出