view general/arrutils/repmat_to.m @ 42:ae596261e75f

Various fixes and development to audio handling
author samer
date Tue, 02 Dec 2014 14:51:13 +0000
parents e44f49929e56
children
line wrap: on
line source
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