MATLAB: Terminating some Simulink samples

datasimulink

I have a serial stream of samples in my Simulink model and I would like to be able to "terminate" the first N samples. Is there a way to do that?

Best Answer

this is how I would do it:
I would put a clock block (in Simulink sources library) and connect it to a "compare to constant" block (in Simulink logic and bit operations library).
This way you can compare the time with any number you choose and you will get a 0 or 1 out of the compare to constant block. Knowing what is your smpling time, you can conver, comparing the clock (time) with a constant to comparing the sample number with a constant just by dividing time out of clock with sampling time which can be found in the "Weighted Sample Time" block (in simulink Signal attributes library)