temporalCount - Number of events, chart executions, or time since state became active - MATLAB (original) (raw)

Main Content

Number of events, chart executions, or time since state became active

Syntax

Description

temporalCount(`E`) returns the number of occurrences of the event E since the associated state became active.

example

temporalCount(`tick`) returns the number of times that the chart has woken up since the associated state became active.

The implicit event tick is not supported when a Stateflow® chart in a Simulink® model has input events.

example

temporalCount(`time_unit`) returns the length of time that has elapsed since the associated state became active. Specifytime_unit as seconds (sec), milliseconds (msec), or microseconds (usec).

example

Note

Standalone Stateflow charts in MATLAB® support using temporalCount only as an absolute-time temporal logic operator.

Examples

expand all

Access successive elements of the array M each time that the chart processes a broadcast of the event E.

In charts in a Simulink model, enter:

on E:
   y = M(temporalCount(E));

Stateflow chart that uses the temporalCount operator in a state.

Using temporalCount as an event-based temporal logic operator is not supported in standalone charts in MATLAB.

Store the value of the input data u in successive elements of the array M.

In charts in a Simulink model, enter:

en,du: M(temporalCount(tick)+1) = u;

Stateflow chart that uses the temporalCount operator in a state.

Using temporalCount as an event-based temporal logic operator is not supported in standalone charts in MATLAB.

Store the number of milliseconds since the state became active.

en,du: y = temporalCount(msec);

Stateflow chart that uses the temporalCount operator in a state.

Tips

Version History

Introduced in R2008a