How can I change elements in a matrix all at once??
Afficher commentaires plus anciens
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)
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
le 25 Sep 2013
Kelly Kearney
le 25 Sep 2013
new = mtx + [mtx(:,2:end) zeros(size(mtx,1),1)]
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!