MATLAB: Is there a function in matlab that creates a binary repetition coder

matlab function

for example when i enter a sequence 0010110 ;when n=3
the result will be 000000111000111111000

Best Answer

s='0010110'
out=repmat(s,3,1)
out=out(:)'
%or
s=[0 0 1 0 1 1 0];
out=reshape(repmat(s,3,1),1,[])