| Signal Processing Blockset™ | ![]() |
Signal Management / Switches and Counters
dspswit3
The Event-Count Comparator block records the number of nonzero inputs to the Data port during the period that the block is enabled by a high signal (the value 1) at the Int port. Both inputs must be scalars; the input to the Int port can be sample based or frame based. When the input to the Data port is frame based, the output is frame based; otherwise, the output is sample based.
When the number of accumulated nonzero inputs first equals the Event threshold setting, the block waits one additional sample interval, and then sets the output high (1). The block holds the output high until recording is restarted by a low-to-high (0-to-1) transition at the Int port.
The Event-Count Comparator block accepts real and complex floating-point and fixed-point inputs. However, because the block has discrete state, it does not support constant or continuous sample times. Therefore, at least one input or output port of the Event-Count Comparator block must be connected to a block whose Sample time parameter is discrete. The Event-Count Comparator block inherits this non-infinite discrete sample time.
In the model below, the Event-Count Comparator block (Event threshold = 3) detects two threshold crossings in the input to the Data port, one at sample 4 and one at sample 12.

All inputs and outputs are multiplexed into the workspace variable yout, whose contents are shown in the figure below. The two left columns in the illustration show the inputs to the Data and Int ports, the center column shows the state of the block's internal counter, and the right column shows the block's output.


Specify the value against which to compare the number of nonzero inputs. Tunable.
Double-precision floating point
Single-precision floating point
Fixed point (signed and unsigned)
Boolean
8-, 16-, and 32-bit signed integers
8-, 16-, and 32-bit unsigned integers
| Counter | Signal Processing Blockset |
| Edge Detector | Signal Processing Blockset |
![]() | Edge Detector | Extract Diagonal | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |