dsp.Counter
(Removed) Count up or down through specified range of numbers
dsp.Counter
has been removed. Alternatively, you can create a variable in
MATLAB® and increment the variable by 1.
Description
The Counter
object counts up or down through a specified
range of numbers.
To count up or down through a specified range of numbers:
Create the
dsp.Counter
object and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
Creation
Description
returns a counter
System object™, count
= dsp.Countercount
, that counts up when the input is
nonzero.
returns a counter System object, count
= dsp.Counter(Name,Value
)count
, with each specified property set to the
specified value.
Properties
Usage
Syntax
Description
[
increments, decrements, or resets the internal counter as specified by the values of the
cnt
,hit
] = count(event
,reset
)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.
[___] = count()
increments or decrements the
free-running internal counter when you set the CountEventInputPort
property to false
and the ResetInputPort
property
to false
.
Input Arguments
Output Arguments
Object Functions
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
Examples
Algorithms
This object implements the algorithm, inputs, and outputs described on the Counter block reference page. The object properties correspond to the block parameters.
The
CountEventCondition
object property does not have a free-running option. Set theCountEventInputPort
property tofalse
to obtain the free-running option.The
CounterSizeSource
andCounterSize
object properties correspond to the Counter size block parameter.The
CountOutputPort
andHitOutputPort
correspond to the Output block parameter.There is no object property that corresponds to the Hit data type block parameter. The output type is logical in MATLAB. (This logical is different from the popup logical in the block. For the object, logical corresponds to Boolean in the block.)