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
John D'Errico 2019 年 2 月 9 日

1 投票

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? :)

1 件のコメント

Fikret Dogru
Fikret Dogru 2019 年 2 月 9 日
Oh sorry, I see. Thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by