System object: dsp.Counter
Package: dsp

Increment or decrement the internal counter


[...] = step(H)
[...] = step(H,EVENT)


[CNT,HIT] = step(H,EVENT,RESET) increments, decrements, or resets the internal counter as specified by the values of the EVENT and RESET inputs. The output argument CNT denotes the present value of the counter. A trigger event at the EVENT input causes the counter to increment or decrement. A trigger event at the RESET input resets the counter to its initial state.

CNT = step(H,EVENT,RESET) returns the current value of the count when you set the CountOutputPort property to true, and the HitOutputPort property to false.

HIT = step(H,EVENT,RESET) returns a Boolean value indicating whether the count has reached any of the values specified by the HitValues property. This condition applies when you set the HitOutputPort property to true and the CountOutputPort property to false.

[...] = step(H) increments or decrements the free-running internal counter when you set the CountEventInputPort property to false and the ResetInputPort property to false.

[...] = step(H,EVENT) increments or decrements the internal counter when the EVENT input matches the event you specify for the CountEventCondition property and you set the ResetInputPort property to false.

    Note:   H specifies the System object™ on which to run this step method.

    The object performs an initialization the first time the step method is executed. This initialization locks nontunable properties and input specifications, such as dimensions, complexity, and data type of the input data. If you change a nontunable property or an input specification, the System object issues an error. To change nontunable properties or inputs, you must first call the release method to unlock the object.

Was this topic helpful?