メインコンテンツ

getActiveChoice

R2026b

バリアント コンポーネントのアクティブな選択肢を取得する

説明

choice = getActiveChoice(variantComponent) は、バリアント コンポーネントでどの選択肢がアクティブであるかを検出します。

例

例

すべて折りたたむ

モデルを作成してルート アーキテクチャを取得し、バリアント コンポーネントを 1 つ作成してバリアント コンポーネントの選択肢を 2 つ追加し、アクティブな選択肢を設定し、アクティブな選択肢を取得します。

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: 216.0013
    SimulinkModelHandle: 147.0011
                   UUID: '6391f2b8-b695-4a8e-a7c1-1dd26a9e909d'
            ExternalUID: ''

入力引数

すべて折りたたむ

バリアント コンポーネント。systemcomposer.arch.VariantComponent オブジェクトとして指定します。

出力引数

すべて折りたたむ

選択されたバリアント。systemcomposer.arch.Component オブジェクトとして返されます。

詳細

すべて折りたたむ

バージョン履歴

R2019a で導入