1 2 3 4 5 6 7 8 9
function r = runsum(x) len = length(x); r = zeros (1, len); r(1) = x(1); for i = 2:len; r(i) = r(i-1) + x(i); endfor; endfunction;