I think I understand what you mean. The code below will overwrite all values that are not NaN for a given depth, which is equivalent to setting it to the last non-NaN (except if the first value is NaN).
u1=rand(241,97,7,1637);u1(u1<0.1)=NaN;u1=cumsum(u1,3);