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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)