Chart executions during which condition is valid
count( returns a double value equivalent to
the number of chart executions (
tick) after the conditional expression,
operator is reset if the conditional expression becomes
false. If the
count operator is used within a state, it is reset when the state that
contains it is entered. If the
count operator is used on a transition, it
is reset when the source state for that transition is entered.
The value for
count depends on the step size. Changing the solver or
step size for your Simulink® model affects the result of Stateflow® charts that include the
To ensure that your Stateflow chart simulates without error, do not use count with these objects:
Continuous time charts
Graphical, MATLAB®, or Simulink functions
Simulink based states
Transitions that can be reached from multiple states
Store the number of chart executions since the variable
data has been greater than 5.
exit: x = count(data>5)
Transition out of the state when the variable
has been greater than or equal to 2 for longer than 5 chart executions.
[count(data >= 2) > 5]