Mercurial > hg > ishara
annotate general/funutils/@function_handle/le.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 3ba80c9914ff |
children |
rev | line source |
---|---|
samer@44 | 1 % le - distribute cell argument to multiple in arguments |
samer@44 | 2 % |
samer@44 | 3 % le :: (A{1:N}=>B{:}), M:natural -> (cell {A{1:M}}, A{M+1:N} -> B{:}). |
samer@44 | 4 % |
samer@53 | 5 % f<=M is a function which takes any number of arguments but where the first |
samer@44 | 6 % argument is assumed to be a cell array of M elements which are distributed |
samer@44 | 7 % to the first M arguments of f. |
samer@44 | 8 |
samer@44 | 9 function g=le(f,I) |
samer@44 | 10 if nargout(f)==1, g=@q1; else g=@qn; end |
samer@44 | 11 |
samer@44 | 12 function x=q1(varargin) |
samer@44 | 13 args1=varargin{1}; |
samer@44 | 14 x=f(args1{1:I},varargin{2:end}); |
samer@44 | 15 end |
samer@44 | 16 function varargout=qn(varargin) |
samer@44 | 17 args1=varargin{1}; |
samer@44 | 18 [varargout{1:nargout}]=f(args1{1:I},varargin{2:end}); |
samer@44 | 19 end |
samer@44 | 20 end |