Main Content

Methods for Interacting with the Operating Point of a Chart

An operating point is a snapshot of the state of a Simulink® model at a specific time during simulation. For a Stateflow® chart, an operating point includes:

  • Activity of chart states

  • Values of chart local data

  • Values of chart output data

  • Values of persistent data in MATLAB® functions and Truth Table blocks

For more information, see Using Operating Points in Stateflow.

You can use the following methods to interact with the operating point of a chart. Assume that ch is a handle to the operating point of your chart, which you obtain using the get (Simulink) 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 operating point to a new variable.

newOperatingPoint = 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 operating point path to a substate (without quotes).

Related Topics