multi dimension colon operation
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
I don't know if 'multi dimension colon operation' can explain my question, what I hope to do is given a matrix:
matrix_in = [1, 2, 3;
2, 3, 4;
3, 4, 5];
for each of the i=1:3 line, return the sum of matrix_in from line 1 to line i, so the output is:
matrix_out = [1, 2, 3;
3, 5, 7;
6, 9, 12];
is there a way of doing this with one line code? Thanks!
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2015년 9월 24일
cumsum(matrix_in)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!