annotate general/arrutils/zipels.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 3cedfd4549ef
children
rev   line source
samer@44 1 function Z=zipels(f,varargin)
samer@44 2 % zipels - Zip a scalar function of several arguments over several arrays
samer@44 3 %
samer@44 4 % zipels ::
samer@44 5 % (A{:}->B)
samer@44 6 % [Size->A{1}],
samer@44 7 % [Size->A{2}],
samer@44 8 % ..
samer@44 9 % -> [Size->B].
samer@44 10
samer@44 11 fN=(f<=length(varargin)); % fN takes a tuple instead of multiple args
samer@44 12 nth=@(i)@(x)x(i);
samer@44 13 Z=repmat(fN(cellmap(nth(1),varargin)),size(varargin{1}));
samer@44 14 for i=2:numel(varargin{1})
samer@44 15 Z(i)=fN(cellmap(nth(i),varargin));
samer@44 16 end