Mercurial > hg > ishara
annotate general/funutils/multicall.m @ 29:61921dceded1
More documentation on type system.
author | samer |
---|---|
date | Sat, 19 Jan 2013 17:56:21 +0000 |
parents | e44f49929e56 |
children |
rev | line source |
---|---|
samer@4 | 1 function varargout=multicall(varargin) |
samer@4 | 2 % multicall - sequential call to several closures, return values from last |
samer@4 | 3 % |
samer@4 | 4 % y=do(f,g,...,h,x) |
samer@4 | 5 % |
samer@4 | 6 % equivalent to |
samer@4 | 7 % f(x); g(x); ...; y=h(x); |
samer@4 | 8 |
samer@4 | 9 for i=1:length(varargin)-1 |
samer@4 | 10 feval(varargin{i}); |
samer@4 | 11 end |
samer@4 | 12 if nargout==0, |
samer@4 | 13 feval(varargin{end}); |
samer@4 | 14 else |
samer@4 | 15 [varargout{1:nargout}]=feval(varargin{end}); |
samer@4 | 16 end |
samer@4 | 17 end |