image thumbnail
from Growing a Compiler by Bill McKeeman
Bootstrap compilers starting from a tiny compiler-compiler.

repeat(chars, n)
% FILE:     repeat.m
% PURPOSE:  multiple interleaved copies of characters
% EXAMPLE
%   strcmp(repeat('abc', 2), 'aabbcc')

% COPYRIGHT: 2009 W. M. McKeeman.  See license.txt.

function reps = repeat(chars, n)
  arg = cellstr(repmat(chars,n,1));
  reps = shuffle(arg{:});
end

Contact us at files@mathworks.com