exportAsStruct
説明
例
構造体の配列の作成
状態遷移表を使用したバンバン制御器のモデル化の状態遷移表の内容を構造体の配列としてエクスポートします。この状態遷移表には、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]
入力引数
table
— 状態遷移表
Stateflow.StateTransitionTableChart
オブジェクト
状態遷移表。Stateflow.StateTransitionTableChart
オブジェクトとして指定します。
hierarchical
— 構造体の階層を作成するかどうか
false
または 0 (既定値) | true
または 1
構造体の階層を作成するかどうか。数値あるいは logical の 1 (true
) または 0 (false
) として指定します。この引数により、出力引数 structure
の形式が決まります。
出力引数
structure
— 状態遷移表の内容
構造体配列
状態遷移表の内容。構造体配列として返されます。structure
の形式は、入力引数 hierarchical
に依存します。
hierarchical
がfalse
の場合、structure
は状態遷移表の各ステートの構造体を含む配列です。これらの構造体のそれぞれにおいて、フィールドdepth
は階層内の各ステートのレベルを示します。構造体の配列の作成を参照してください。hierarchical
がtrue
の場合、structure
はフィールドtableData
、columnWidths
、およびtableId
をもつ構造体です。tableData
は、状態遷移表の各最上位ステートの構造体を含む配列です。これらの構造体のそれぞれにおいて、フィールドchildren
は各サブステートの構造体を含む配列です。状態遷移表内のステートの以降の階層レベルにおいても同様となります。構造体の階層の作成を参照してください。
バージョン履歴
R2022b で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)