annotate 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 |
|
rev |
line source |
samer@0
|
1 % utransfer - Run a processing unit, passing data through and collecting outputs
|
samer@0
|
2 %
|
samer@0
|
3 % utransfer ::
|
samer@0
|
4 % unit({[[N,1]]}, {[[M,1]]}, _) ~'live processing unit',
|
samer@0
|
5 % [[N,T]] ~'data to pass through',
|
samer@0
|
6 % options {
|
samer@0
|
7 % draw :: boolean/false ~'whether or not to call drawnow after each iteration';
|
samer@0
|
8 % quiet :: boolean/false ~'whether or not to suppress progress messages'
|
samer@0
|
9 % }
|
samer@0
|
10 % -> [[M,T]] ~'collected output'.
|
samer@0
|
11 %
|
samer@0
|
12 % This function accepts the live processing unit associated
|
samer@0
|
13 % with an arrow (as created by with_arrow). The arrow must
|
samer@0
|
14 % have zero inputs and one output. The requested number of outputs
|
samer@0
|
15 % are collected into an array and returned. If inf outputs are
|
samer@0
|
16 % requested, the system is run until an EOF exception is caught.
|
samer@0
|
17
|
samer@0
|
18 function Y=utransfer(u,X,varargin)
|
samer@0
|
19 Y=zeros(u.sizes_out{1}(1),size(X,2));
|
samer@0
|
20 uiter(u,size(X,2),@transferx,[],'label','utransfer',varargin{:});
|
samer@0
|
21
|
samer@0
|
22 function s=transferx(i,s), Y(:,i)=u.process(X(:,i)); end
|
samer@0
|
23 end
|