view arrows/@asink/construct.m @ 0:672052bd81f8

Initial partial import.
author samer
date Wed, 19 Dec 2012 22:38:28 +0000
parents
children ae596261e75f
line wrap: on
line source
function u=construct(s,sizes_in)
	u=mkunit(s);
	if sizes_in{1}(1)~=channels(s.sink)
		error('Number of rows in input does not match channels in sink');
	end
	snk=construct(s.sink);
	
	if isempty(s.window), 
		write=snk.writer(sizes_in{1}(2));
		u.process=@proc1;
	else 
		WIN=s.window; 
		write=snk.writer(length(WIN)); 
		u.process=@proc2;
	end

	u.sizes_out = {};
	u.dispose   = snk.dispose;
	u.starting  = snk.start;
	u.stopping  = snk.stop;

	function proc1(x), write(x); end
	function proc2(x), write(x(:,WIN)); end
end