Mercurial > hg > ishara
comparison general/funutils/@function_handle/le.m @ 44:3cedfd4549ef
Code added since initial check in.
author | samer |
---|---|
date | Tue, 13 Jan 2015 14:03:17 +0000 |
parents | |
children | 3ba80c9914ff |
comparison
equal
deleted
inserted
replaced
43:62e31e7980e6 | 44:3cedfd4549ef |
---|---|
1 % le - distribute cell argument to multiple in arguments | |
2 % | |
3 % le :: (A{1:N}=>B{:}), M:natural -> (cell {A{1:M}}, A{M+1:N} -> B{:}). | |
4 % | |
5 % f<=5 is a function which takes any number of arguments but where the first | |
6 % argument is assumed to be a cell array of M elements which are distributed | |
7 % to the first M arguments of f. | |
8 | |
9 function g=le(f,I) | |
10 if nargout(f)==1, g=@q1; else g=@qn; end | |
11 | |
12 function x=q1(varargin) | |
13 args1=varargin{1}; | |
14 x=f(args1{1:I},varargin{2:end}); | |
15 end | |
16 function varargout=qn(varargin) | |
17 args1=varargin{1}; | |
18 [varargout{1:nargout}]=f(args1{1:I},varargin{2:end}); | |
19 end | |
20 end |