Skip to Main Content Skip to Search
Product Documentation

Methods for Interacting with the SimState of a Chart

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 ObjectMethodDescriptionExample

All chart objects

open

For graphical objects, highlights the object in the Stateflow Editor.

For nongraphical objects, highlights the object in the Model Explorer.

    Note   For persistent data in MATLAB functions, this method opens the function editor and highlights the persistent data at the exact line in the script.

ch.data.open

Chart

checkStateConsistency

Verifies that all states in a chart are consistent.

  • If a state is inactive, no substates are active.

  • If a state with parallel decomposition is active, all substates are active.

  • If a state with exclusive decomposition is active, only one substate is active.

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')

    Note   The argument must be the name of a substate (in quotes), or the full SimState path to a substate (without quotes).

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS