view arrows/utransfer.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 672052bd81f8
children
line wrap: on
line source
% utransfer - Run a processing unit, passing data through and collecting outputs
%
% utransfer :: 
%    unit({[[N,1]]}, {[[M,1]]}, _) ~'live processing unit',
%    [[N,T]]                       ~'data to pass through',
%    options {
%       draw  :: boolean/false ~'whether or not to call drawnow after each iteration';
%       quiet :: boolean/false ~'whether or not to suppress progress messages'
%    } 
% -> [[M,T]] ~'collected output'.
%
% This function accepts the live processing unit associated
% with an arrow (as created by with_arrow). The arrow must
% have zero inputs and one output. The requested number of outputs
% are collected into an array and returned. If inf outputs are
% requested, the system is run until an EOF exception is caught.

function Y=utransfer(u,X,varargin)
	Y=zeros(u.sizes_out{1}(1),size(X,2));
	uiter(u,size(X,2),@transferx,[],'label','utransfer',varargin{:});

	function s=transferx(i,s), Y(:,i)=u.process(X(:,i)); end
end