| Contents | Index |
You can use the following methods to interact with the SimState of a chart. Assume that ch is a handle to the SimState of your chart, which you obtain using the getBlockSimState method.
| Type of Object | Method | Description | Example |
|---|---|---|---|
All chart objects | open | For graphical objects, highlights the object in the Stateflow Editor. For nongraphical objects, highlights the object in the Model Explorer. | ch.data.open |
Chart | checkStateConsistency | Verifies that all states in a chart are consistent.
| ch.checkStateConsistency |
Chart | clone | Copies the entire chart simulation state to a new variable. | newSimState = ch.clone |
Chart | highlightActiveStates | Highlights all active states in the Stateflow Editor. | ch.highlightActiveStates |
Chart | isStateConsistent | Returns true (1) if all states pass a consistency check and false (0) otherwise. | ch.isStateConsistent |
Chart | removeHighlighting | Removes all highlighting in the Stateflow Editor. | ch.removeHighlighting |
State | isActive | Returns true (1) if a state is active and false (0) otherwise. | ch.state.isActive |
State Must be an exclusive leaf state | setActive | Sets a state to be active. This method ensures that no other exclusive states at that level are active. | ch.state.substate.setActive |
State Must have a history junction and exclusive substates | getPrevActiveChild | Returns the previously active substate. | ch.state.getPrevActiveChild |
State Must be inactive; must have a history junction and exclusive substates | setPrevActiveChild | Sets the previously active substate. | ch.state.setPrevActiveChild('B') |
![]() | Testing a Chart with Fault Detection and Redundant Logic | Rules for Using the SimState of a Chart | ![]() |

Learn how engineers use Stateflow to model state machines in their Simulink models.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |