annotate arrows/@aconnect/aconnect.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 % aconnect - serial connection of two arrows
|
samer@0
|
2 %
|
samer@0
|
3 % aconnect ::
|
samer@0
|
4 % arrow(T1,T2,S1), arrow(T2,T3,S2)
|
samer@0
|
5 % -> arrow(T1,T3, pair(S1,S2)).
|
samer@0
|
6 %
|
samer@0
|
7 % The first arrow must have the same number of outputs
|
samer@0
|
8 % and as the second arrow has inputs. The resulting
|
samer@0
|
9 % arrow has a state type consisting of a two element
|
samer@0
|
10 % cell array with elements of type S1 and S2.
|
samer@0
|
11
|
samer@0
|
12 function o=aconnect(o1,o2,varargin)
|
samer@0
|
13
|
samer@0
|
14 if nargin<1, o1=aid; o2=aid; end
|
samer@0
|
15 if nargout(o1)~=nargin(o2)
|
samer@0
|
16 error(sprintf('Connecting units: port number mismatch between \n %s (%d outputs)\nand %s (%d inputs)', ...
|
samer@0
|
17 tostring(o1),nargout(o1),tostring(o2),nargin(o2)));
|
samer@0
|
18 end
|
samer@0
|
19
|
samer@0
|
20 s.unit1=o1;
|
samer@0
|
21 s.unit2=o2;
|
samer@0
|
22
|
samer@0
|
23 o=class(s,'aconnect',arrow(nargin(o1),nargout(o2)));
|
samer@0
|
24 end
|