function y = colcopy(v,n) % COLCOPY y = colcopy(v,n) n columns of v % Version of 6/8/95 (Arguments reversed 5/7/96) % v a row or column vector % Treats v as column vector % and makes n copies % Procedure based on "Tony's trick" [r,c] = size(v); if r == 1 v = v'; end y = v(:,ones(1,n));