%function to test a different read out strategy
function [output] = RO_test(signal)
global Nn,global Nd

buffer = [];output = [];
k=0;

%initialize a old vector
old = zeros(Nn,1);
tic
while (length(signal)-(k*Nd+Nd) >= 0)
    if (k == 0)
        x = [zeros(Nd,1);signal(1:Nd,1)];
        d = signal(1:Nd,1);
    else
        x = signal((k*Nd-Nd)+1:(k*Nd+Nd),1);
        d = signal((k*Nd+1):(k*Nd+Nd),1);
    end
    
    out = IO_test(x,Nd);
    buffer = [buffer out'];
    
    if (length(buffer) >= Nn)
        x2 = [old;buffer(1,1:Nn)'];
        old = buffer(1,1:Nn)';
        buffer = buffer(1,Nn+1:end);
        
        out2 = IO_test(x2,Nn);
        output = [output out2'];
    end
    
    k = k+1;
end
display(toc)