view general/funutils/foreach.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +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