| Signal Processing Blockset™ | ![]() |
Signal Processing Sources
dspsrcs4
Signal Management / Switches and Counters
dspswit3
The N-Sample Enable block outputs the inactive value (0 or 1, whichever is not selected in the Active level parameter) during the first N sample times, where N is the Trigger count value. Beginning with output sample N+1, the block outputs the active value (1 or 0, whichever you select in the Active level parameter) until a reset event occurs or the simulation terminates.
The output is always sample based.
The Reset input check box enables the Rst input port. At any time during the count, a trigger event at the input port resets the counter to its initial state. The reset sample time must be a positive integer multiple of the input sample time. This block supports triggered subsystems when you select the Reset input check box.
You specify the triggering event in the Trigger type pop-up menu:
Rising edge — Triggers a reset operation when the Rst input does one of the following:
Rises from a negative value to a positive value or zero
Rises from zero to a positive value, where the rise is not a continuation of a rise from a negative value to zero (see the following figure)

Falling edge — Triggers a reset operation when the Rst input does one of the following:
Falls from a positive value to a negative value or zero
Falls from zero to a negative value, where the fall is not a continuation of a fall from a positive value to zero (see the following figure)

Either edge — Triggers a reset operation when the Rst input is a Rising edge or Falling edge (as described above).
Non-zero sample — Triggers a reset operation at each sample time that the Rst input is not zero.
Note When running simulations in the Simulink® MultiTasking mode, sample-based reset signals have a one-sample latency, and frame-based reset signals have one frame of latency. Thus, there is a one-sample or one-frame delay between the time the block detects a reset event, and when it applies the reset. For more information on latency and the Simulink tasking modes, see Excess Algorithmic Delay (Tasking Latency) and Models with Multiple Sample Rates in the Real-Time Workshop® User's Guide. |

Opening this dialog causes a running simulation to pause. See Changing Source Block Parameters During Simulation in the online Simulink documentation for details.
Specify the number of samples for which the block outputs the active value. Tunable.
Specify the value to output after the first N sample times, 0 or 1. Tunable.
Select to enable the Rst input port. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input.
Select type of event that triggers a reset when the Rst port is enabled.
Specify the sample period, Ts, for the block's counter. The block switches from the active value to the inactive value at t=Ts*(N+1).
Select the output data type. For information on the Logical and Boolean options of this parameter, see Effects of Enabling and Disabling Boolean Support.
Double-precision floating point
Boolean — The block accepts Boolean inputs to the Rst port, which is enabled when you set the Reset input parameter. The block might output Boolean values depending on the Output data type parameter setting, as described in Effects of Enabling and Disabling Boolean Support. To learn how to disable Boolean output support, see Steps to Disabling Boolean Support.
| Counter | Signal Processing Blockset |
| N-Sample Switch | Signal Processing Blockset |
![]() | Multiport Selector | N-Sample Switch | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |