samer@0: % aconnect - serial connection of two arrows samer@0: % samer@0: % aconnect :: samer@0: % arrow(T1,T2,S1), arrow(T2,T3,S2) samer@0: % -> arrow(T1,T3, pair(S1,S2)). samer@0: % samer@0: % The first arrow must have the same number of outputs samer@0: % and as the second arrow has inputs. The resulting samer@0: % arrow has a state type consisting of a two element samer@0: % cell array with elements of type S1 and S2. samer@0: samer@0: function o=aconnect(o1,o2,varargin) samer@0: samer@0: if nargin<1, o1=aid; o2=aid; end samer@0: if nargout(o1)~=nargin(o2) samer@0: error(sprintf('Connecting units: port number mismatch between \n %s (%d outputs)\nand %s (%d inputs)', ... samer@0: tostring(o1),nargout(o1),tostring(o2),nargin(o2))); samer@0: end samer@0: samer@0: s.unit1=o1; samer@0: s.unit2=o2; samer@0: samer@0: o=class(s,'aconnect',arrow(nargin(o1),nargout(o2))); samer@0: end