Chart executions during which condition is valid
count( returns the number of times that the
chart has woken up since the conditional expression
true and the associated state became active.
Guard Transition with Temporal Condition
Transition out of the associated state when the variable
x has been greater than or equal to 2 for longer than five chart
[count(x>=2) > 5]
Determine Number of Chart Executions
Store the number of chart executions since the variable
x became greater than 5.
en,du: y = count(x>5);
The Stateflow® chart resets the value of the
countoperator if the conditional expression becomes
falseor if the associated state becomes inactive.
When a chart in a Simulink® model does not have input events, the value of
countdepends on the step size. Changing the solver or step size for the model affects the results produced by the
To ensure that your Stateflow chart simulates without error, do not use count in these objects:
Continuous time charts
Graphical, MATLAB®, or Simulink functions
Simulink based states
Transitions that can be reached from multiple states