view general/arrutils/foldcols.m @ 37:beb8a3f4a345

Renamed prefs to options throughout.
author samer
date Mon, 28 Jan 2013 10:52:11 +0000
parents fbc0540a9208
children
line wrap: on
line source
% foldcols - fold from left combinator for columns of an array
%
% foldcols :; 
%    (A,[[N]]->A) ~'folding function',
%    A            ~'initial value',
%    [[N,L]]      ~'data to scan, sequence of length L'
% -> A.

function y=foldcols(f,y,X)
	for i=1:size(X,2), y=f(y,X(:,i)); end
end