view general/arrutils/foldrcols.m @ 44:3cedfd4549ef

Code added since initial check in.
author samer
date Tue, 13 Jan 2015 14:03:17 +0000
parents 03694e5c8365
children
line wrap: on
line source
% foldrcols - fold array columns from the right
%
% foldrcols :; 
%    ([[M]], [[N]] -> [[M]])   ~'folding function',
%    [[M]]                     ~'initial value',
%    [[N,L]]                   ~'data to scan, sequence of length L'
% -> [[M]].

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