Main Content

exportAsStruct

状態遷移表の内容を構造体配列としてエクスポート

R2022b 以降

説明

structure = exportAsStruct(table) は、状態遷移表 table の内容を含む構造体配列を返します。

structure = exportAsStruct(table,hierarchical) は、hierarchical の値に基づいて、関数が構造体の配列または構造体の階層のどちらを返すかを指定します。

すべて折りたたむ

状態遷移表を使用したバンバン制御器のモデル化の状態遷移表の内容を構造体の配列としてエクスポートします。この状態遷移表には、2 つの最上位ステートと 3 つのサブステートが含まれています。

状態遷移表の Stateflow.StateTransitionTableChart にアクセスします。

table = find(sfroot,"-isa","Stateflow.StateTransitionTableChart");

状態遷移表の内容を、構造体の配列としてエクスポートします。

structure = exportAsStruct(table)
structure = 

  1×5 struct array with fields:

    rowText
    depth
    rowType
    isDefaultTransitionOwner
    isWhenState
    hasHistory
    isExpanded
    outlinedTransitionIdxs
    sfObjectInfo
    aslInfo
    decompositionInfo

最上位ステートの内容を表示します。

structure(1)
ans = 

  struct with fields:

                     rowText: {'Normal'  {3×1 cell}  {3×1 cell}}
                       depth: 1
                     rowType: 0
    isDefaultTransitionOwner: 1
                 isWhenState: 0
                  hasHistory: 0
                  isExpanded: 1
      outlinedTransitionIdxs: [0 0 0]
                sfObjectInfo: [1×3 struct]
                     aslInfo: [1×1 struct]
           decompositionInfo: [1×1 struct]

子ステートの内容を表示します。

structure(4)
ans = 

  struct with fields:

                     rowText: {'On↵entry:↵boiler_cmd = 1;'  {3×1 cell}  {3×1 cell}}
                       depth: 2
                     rowType: 0
    isDefaultTransitionOwner: 0
                 isWhenState: 0
                  hasHistory: 0
                  isExpanded: 0
      outlinedTransitionIdxs: [0 0 0]
                sfObjectInfo: [1×3 struct]
                     aslInfo: [1×1 struct]
           decompositionInfo: [1×1 struct]

状態遷移表を使用したバンバン制御器のモデル化の状態遷移表の内容を構造体の階層としてエクスポートします。この状態遷移表には、2 つの最上位ステートと 3 つのサブステートが含まれています。

状態遷移表の Stateflow.StateTransitionTableChart にアクセスします。

table = find(sfroot,"-isa","Stateflow.StateTransitionTableChart");

状態遷移表の内容を構造体の階層としてエクスポートします。

structure = exportAsStruct(table,true)
structure = 

  struct with fields:

       tableData: [1×2 struct]
    columnWidths: [209 175 174]
         tableId: 172

最上位ステートの内容を表示します。

structure.tableData(1)
ans = 

  struct with fields:

                  stateLabel: 'Normal'
                 transitions: [1×2 struct]
                  rowHeights: {[30]  [30]  [30]}
                  hasHistory: 0
    isDefaultTransitionOwner: 1
                 isWhenState: 0
                  isExpanded: 1
             hasRequirements: 0
              hasBreakpoints: 0
       hasEnabledBreakpoints: 0
                    children: [1×3 struct]
                     rowType: 0
        possibleDestinations: {''  'Alarm'  '$NEXT'  '$SELF'  '% IGNORE %'}
           decompositionInfo: [1×1 struct]

子ステートの内容を表示します。

structure.tableData(1).children(3)
ans = 

  struct with fields:

                  stateLabel: 'On↵entry:↵boiler_cmd = 1;'
                 transitions: [1×2 struct]
                  rowHeights: {[53]  [30]  [30]}
                  hasHistory: 0
    isDefaultTransitionOwner: 0
                 isWhenState: 0
                  isExpanded: 0
             hasRequirements: 0
              hasBreakpoints: 0
       hasEnabledBreakpoints: 0
                    children: []
                     rowType: 0
        possibleDestinations: {''  '$PREV'  'Off'  'Warmup'  '$SELF'  '% IGNORE %'}
           decompositionInfo: [1×1 struct]

入力引数

すべて折りたたむ

状態遷移表。Stateflow.StateTransitionTableChart オブジェクトとして指定します。

構造体の階層を作成するかどうか。数値あるいは logical の 1 (true) または 0 (false) として指定します。この引数により、出力引数 structure の形式が決まります。

出力引数

すべて折りたたむ

状態遷移表の内容。構造体配列として返されます。structure の形式は、入力引数 hierarchical に依存します。

  • hierarchicalfalse の場合、structure は状態遷移表の各ステートの構造体を含む配列です。これらの構造体のそれぞれにおいて、フィールド depth は階層内の各ステートのレベルを示します。構造体の配列の作成を参照してください。

  • hierarchicaltrue の場合、structure はフィールド tableDatacolumnWidths、および tableId をもつ構造体です。tableData は、状態遷移表の各最上位ステートの構造体を含む配列です。これらの構造体のそれぞれにおいて、フィールド children は各サブステートの構造体を含む配列です。状態遷移表内のステートの以降の階層レベルにおいても同様となります。構造体の階層の作成を参照してください。

バージョン履歴

R2022b で導入