samer@0: % utransfer - Run a processing unit, passing data through and collecting outputs samer@0: % samer@0: % utransfer :: samer@0: % unit({[[N,1]]}, {[[M,1]]}, _) ~'live processing unit', samer@0: % [[N,T]] ~'data to pass through', samer@0: % options { samer@0: % draw :: boolean/false ~'whether or not to call drawnow after each iteration'; samer@0: % quiet :: boolean/false ~'whether or not to suppress progress messages' samer@0: % } samer@0: % -> [[M,T]] ~'collected output'. samer@0: % samer@0: % This function accepts the live processing unit associated samer@0: % with an arrow (as created by with_arrow). The arrow must samer@0: % have zero inputs and one output. The requested number of outputs samer@0: % are collected into an array and returned. If inf outputs are samer@0: % requested, the system is run until an EOF exception is caught. samer@0: samer@0: function Y=utransfer(u,X,varargin) samer@0: Y=zeros(u.sizes_out{1}(1),size(X,2)); samer@0: uiter(u,size(X,2),@transferx,[],'label','utransfer',varargin{:}); samer@0: samer@0: function s=transferx(i,s), Y(:,i)=u.process(X(:,i)); end samer@0: end