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?

Answers (2)

Jan
Jan on 25 Sep 2013
Edited: Jan on 25 Sep 2013
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.

1 Comment

For example if I have mtx = [1 2 3; 4 5 6; 7 8 9] then the new element would be [3 5 3; 9 11 6; 15 17 9] Something like that.

Sign in to comment.

Asked:

on 25 Sep 2013

Community Treasure Hunt

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

Start Hunting!