## 3D data cumsum does not work

### Fikret Dogru (view profile)

on 9 Feb 2019
Latest activity Commented on by Fikret Dogru

on 9 Feb 2019

### John D'Errico (view profile)

Hello all,
I have a 3D data like 2532X3542X26. I combined 26 number of 2D data 2532X3542 because of some reason. So now, I want to sum of the all matrices like following:
qq(:,:,1)=R(:,:,1);
qq(:,:,2)=R(:,:,1)+R(:,:,2);
qq(:,:,3)=R(:,:,1)+R(:,:,2)+R(:,:,3);
qq(:,:,4)=R(:,:,1)+R(:,:,2)+R(:,:,3)+R(:,:,4);
qq(:,:,5)=R(:,:,1)+R(:,:,2)+R(:,:,3)+R(:,:,4)+R(:,:,5);
qq(:,:,6)=R(:,:,1)+R(:,:,2)+R(:,:,3)+R(:,:,4)+R(:,:,5)+R(:,:,6);
qq(:,:,7)=R(:,:,1)+R(:,:,2)+R(:,:,3)+R(:,:,4)+R(:,:,5)+R(:,:,6)+R(:,:,7);
qq(:,:,8)=R(:,:,1)+R(:,:,2)+R(:,:,3)+R(:,:,4)+R(:,:,5)+R(:,:,6)+R(:,:,7)+R(:,:,8);
qq(:,:,9)=R(:,:,1)+R(:,:,2)+R(:,:,3)+R(:,:,4)+R(:,:,5)+R(:,:,6)+R(:,:,7)+R(:,:,8)+R(:,:,9);
.
.
until qq(:,:,26)=R(:,:,1)+R(:,:,2)+R(:,:,3)+R(:,:,4)+R(:,:,5)+R(:,:,6)+R(:,:,7)+R(:,:,8)+R(:,:,9)+......+R(:,:,26);
Please help me another way to do it. I do not use like a this way. I need a for loop but I could not achieve it correctly. Thanks all
Fikret

### John D'Errico (view profile)

on 9 Feb 2019

Oh. So it does not work if you do this?
qq = cumsum(rr,3);
I guess you should report that as a bug, because it works for me. I wonder why it fails for you? :)

Fikret Dogru

### Fikret Dogru (view profile)

on 9 Feb 2019
Oh sorry, I see. Thank you so much.