function s=resamplex(fs,sigs,varargin)
	opts=options(varargin{:});
	[s1,sx]=feval(rsx1(sigs{1},sigs(2:end)));
	s=siglzcat(s1,sx);

	function f=rsx1(h,t), f=@()rsx3({h},rate(h),t); end
	function [s1,sx]=rsx3(heads,fh,tails)
		if ~isempty(tails) && rate(tails{1})==fh
			[s1,sx]=rsx3([heads,tails(1)],fh,tails(2:end));
		else 
			s1=resample(fs,sigcat(heads{:}),opts);
			if isempty(tails), sx=[];
			else sx=rsx1(tails{1},tails(2:end));
			end
		end
	end
end

function s=resamplex1(fs,signals)
	s=rsx1(signals);

	function s=rsx1(signals)
		s=rsx3(signals(1),rate(signals{1}),signals(2:end));
	end

	function s=rsx3(heads,fh,tails)
		if ~isempty(tails) && rate(tails{1})==fh
			s=rsx3([heads,tails(1)],fh,tails(2:end));
		else 
			headsig=resample(fs,sigcat(heads{:}),opts);
			if isempty(tails), s=headsig;
			else s=siglzcat(headsig, @()deal(rsx1(tails),[]));
			end
		end
	end
end

