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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2019년 2월 9일

댓글:

2019년 2월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by