I can think of 3 independent ways to implement a basic cumsum (ignoring its ability to handle n-D arrays).
There is a way using a for loop that Jan suggested and Anthony is trying to use.
There is a way using recursion.
There is a way using matrix multiplication (hint tril).
There might also be ways to use accumarray, bsxfun, and arrayfun, although I cannot easily think of how to do it. I am not sure which way is most efficient.