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
decompositionInfoView 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: 172View 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
hierarchicalisfalse,structureis an array that contains a structure for each state in the state transition table. In each of these structures, the fielddepthindicates the level of each state in the hierarchy. See Create Array of Structures.If
hierarchicalistrue,structureis a structure with the fieldstableData,columnWidths, andtableId.tableDatais an array that contains a structure for each top-level state in the state transition table. In each of these structures, the fieldchildrenis 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)