exportAsStruct
Description
specifies whether the function returns an array of structures or a hierarchy of structures
based on the value of structure
= exportAsStruct(table
,hierarchical
)hierarchical
.
Examples
Export the contents of the state transition table in Model Bang-Bang Controller by Using a State Transition Table as an array of structures. This state transition table contains two top-level states and three substates.
Access Stateflow.StateTransitionTableChart
for the state transition
table.
table = find(sfroot,"-isa","Stateflow.StateTransitionTableChart");
Export the contents of the state transition table as an array of structures.
structure = exportAsStruct(table)
structure = 1×5 struct array with fields: rowText depth rowType isDefaultTransitionOwner isWhenState hasHistory isExpanded outlinedTransitionIdxs sfObjectInfo aslInfo decompositionInfo
View the contents of a top-level state.
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]
View the contents of a child state.
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]
Export the contents of the state transition table in Model Bang-Bang Controller by Using a State Transition Table as a hierarchy of structures. This state transition table contains two top-level states and three substates.
Access Stateflow.StateTransitionTableChart
for the state transition
table.
table = find(sfroot,"-isa","Stateflow.StateTransitionTableChart");
Export the contents of the state transition table as a hierarchy of structures.
structure = exportAsStruct(table,true)
structure = struct with fields: tableData: [1×2 struct] columnWidths: [209 175 174] tableId: 172
View the contents of a top-level state.
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]
View the contents of a child state.
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]
Input Arguments
State transition table, specified as a Stateflow.StateTransitionTableChart
object.
Whether to create a hierarchy of structures, specified as a numeric or logical 1
(true
) or 0 (false
). This argument determines
the format of the output argument structure
.
Output Arguments
Contents of state transition table, returned as a structure array. The format of
structure
depends on the input argument
hierarchical
:
If
hierarchical
isfalse
,structure
is an array that contains a structure for each state in the state transition table. In each of these structures, the fielddepth
indicates the level of each state in the hierarchy. See Create Array of Structures.If
hierarchical
istrue
,structure
is a structure with the fieldstableData
,columnWidths
, andtableId
.tableData
is an array that contains a structure for each top-level state in the state transition table. In each of these structures, the fieldchildren
is an array that contains a structure for each substate. This pattern continues down the hierarchy of states in the state transition table. See Create Hierarchy of Structures.
Version History
Introduced in R2022b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)