function b=repmat_to(a,sz)
% repmat_to(a,sz): Like repmat, but sz is TARGET size, not repliction count
%
% repmat_to :: [[Size1]->A], Size2:dim -> [[Size2]->A].

% this will barf if any dimension of a is zero.
	if any(sz==0)
		b=zeros(sz);
	else
		sa=size1(a);
		l=length(sz)-length(sa);
		b=repmat(a,tosize(sz./[sa ones(1,l)]));
	end
				
