Cumulative sum while skiping NaN's.
y = nan_cumsum(x,DIM)
dimension
first DIMENSION, with more than 1 element
input data
resulting sum
NaN values are not thown away, but skipped.
x=[1 2 %nan 5]; cumsum(x) ans = 1. 3. Nan Nan cumsum(thrownan(x)) ans = 1. 3. 8. nan_cumsum(x) ans = 1. 3. Nan 8.