annotate general/funutils/bindat.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents e44f49929e56
children
rev   line source
samer@4 1 function cfn=bindat(fn,varargin)
samer@4 2 % bindat - Create function with bound arguments at given positions
samer@4 3 %
samer@4 4 % BINDAT(fn,positions,arguments)
samer@4 5 % If fn is an ordinary function handle, the parameters a1, a2 etc
samer@4 6 % are bound at the positions given
samer@4 7 %
samer@4 8 % If fn is a closure as returned by FUNC, BIND, or PERM,
samer@4 9 % the given parameters are bound to the specified slots of the function.
samer@4 10 %
samer@4 11 % Eg, a function which divides a value by 4 can be given as
samer@4 12 %
samer@4 13 % quarter = bindat(@rdivide,2,2);
samer@4 14 % quarter(8)
samer@4 15 % ans = 2
samer@4 16
samer@4 17 if ischar(fn), fn=str2func(fn); end
samer@4 18 if ~isa(fn,'func'), fn=func(fn); end
samer@4 19 cfn=bindat(fn,varargin{:});