% test orig_length=200; seq=zeros(1,orig_length); for i=1:orig_length seq(1,i)=i; i=i+1; end for i=1:orig_length seq(2*i)=0; end h=0; for i=1:orig_length if seq(i)==0, h=h+1; end i=i+1; h=h+1; end seq