view general/funutils/foreach.m @ 8:f0a3d7d7a0e3

Renamed cat_sep function to catsep
author samer
date Mon, 14 Jan 2013 14:54:10 +0000
parents e44f49929e56
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