Main Content

Event-Count Comparator

Detect threshold crossing of accumulated nonzero inputs


Signal Management / Switches and Counters


  • Event-Count Comparator block


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.

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.


Event threshold

Specify the value against which to compare the number of nonzero inputs. Tunable (Simulink).

Supported Data Types

  • 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

  • Enumerated

Extended Capabilities

Version History

Introduced before R2006a