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?

Réponses (2)

Jan
Jan le 25 Sep 2013
Modifié(e) : Jan le 25 Sep 2013

0 votes

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 commentaire

Ken Mills
Ken Mills le 25 Sep 2013
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.

Connectez-vous pour commenter.

Catégories

Question posée :

le 25 Sep 2013

Community Treasure Hunt

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

Start Hunting!

Translated by