How can I change elements in a matrix all at once??
Mostrar comentarios más antiguos
How can I change each element in a matrix so that each new element is for example itself + the element next to it?
Respuestas (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 comentario
Ken Mills
el 25 de Sept. de 2013
Kelly Kearney
el 25 de Sept. de 2013
new = mtx + [mtx(:,2:end) zeros(size(mtx,1),1)]
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!