How can I change elements in a matrix all at once??
이전 댓글 표시
How can I change each element in a matrix so that each new element is for example itself + the element next to it?
답변 (2개)
This seems to be a job for cumsum. A small example would clear the details.
[EDITED] After your comment: NO, not cumsum. See Kelly's answer.
Kelly Kearney
2013년 9월 25일
new = mtx + [mtx(:,2:end) zeros(size(mtx,1),1)]
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!