Mercurial > hg > ishara
view general/arrutils/forels.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 03694e5c8365 |
children |
line wrap: on
line source
% forels - do an action for each element of an array in order % % forels :: % (A->action) ~'action to apply to each element', % [[Size]->A] ~'array of elements of type', % options iterate_options % => void. % % Note, the array can be multidimensional - the standard order % cycles through the earlier indices before the later ones, eg % rows, then columns, then slices etc. function forels(f,X,varargin) N=numel(X); iterate(@g,1,varargin{:}); function i=g(i) if i>N, i=[]; else f(X(i)); i=i+1; end end end