This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


System object: dsp.Counter
Package: dsp

Increment or decrement the internal counter


[CNT,HIT] = step(count,EVENT,RESET)
CNT = step(count,EVENT,RESET)
HIT = step(count,EVENT,RESET)
[...] = step(count)
[...] = step(count,EVENT)



Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

[CNT,HIT] = step(count,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(count,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(count,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(count) increments or decrements the free-running internal counter when you set the CountEventInputPort property to false and the ResetInputPort property to false.

[...] = step(count,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.


obj 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 (MATLAB) 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?