Mercurial > hg > ishara
view general/funutils/foreach.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author | samer |
---|---|
date | Sat, 12 Jan 2013 19:21:22 +0000 |
parents | |
children | 45aaf9b2d7b0 |
line wrap: on
line source
function foreach(f,X,varargin) % foreach - do an action for each element in a cell array in order % % foreach :: (A->action), {[N]->A} -> action. % foreach :: (A->action), {[N]->A}, options {} -> action. % % Takes the same options as iterate. iterate(@g,X,varargin{:}); function x=g(x) f(x{1}); x=x(2:end); end end