Mercurial > hg > ishara
view 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 |
line wrap: on
line source
% le - distribute cell argument to multiple in arguments % % le :: (A{1:N}=>B{:}), M:natural -> (cell {A{1:M}}, A{M+1:N} -> B{:}). % % f<=M is a function which takes any number of arguments but where the first % argument is assumed to be a cell array of M elements which are distributed % to the first M arguments of f. function g=le(f,I) if nargout(f)==1, g=@q1; else g=@qn; end function x=q1(varargin) args1=varargin{1}; x=f(args1{1:I},varargin{2:end}); end function varargout=qn(varargin) args1=varargin{1}; [varargout{1:nargout}]=f(args1{1:I},varargin{2:end}); end end