%% Delay Line
% Note: If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes  step(obj,x).
% Use a delay line object with a delay line size of 4 samples.

delayline = dsp.DelayLine( ...
    'Length', 4, ...
    'DirectFeedthrough', true, ...
    'InitialConditions', -2, ...
    'EnableOutputInputPort', true, ...
    'HoldPreviousValue', true);
en = logical([1 1 0 1 0]);
y = zeros(4,5);
for ii = 1:5
    y(:,ii) = delayline(ii, en(ii));
end
disp(y);