view 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
line wrap: on
line source
function Z=zipels(f,varargin)
% zipels - Zip a scalar function of several arguments over several arrays
%
% zipels :: 
%    (A{:}->B) 
%    [Size->A{1}],
%    [Size->A{2}],
%    ..
% -> [Size->B].

fN=(f<=length(varargin)); % fN takes a tuple instead of multiple args
nth=@(i)@(x)x(i);
Z=repmat(fN(cellmap(nth(1),varargin)),size(varargin{1}));
for i=2:numel(varargin{1})
	Z(i)=fN(cellmap(nth(i),varargin));
end