Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

i want to sum each row of a matrix to the next row of the same matrix and save it in a new variable. its a part of big algorithm.

1 visualizzazione (ultimi 30 giorni)
let the matrix is this
A= [1 2 3 4; 5 6 7 8; 4 3 2 1];
and i want to get this
X=[1 2 3 4; 6 8 10 12; 10 11 12 13];
thanks in advance...

Risposte (2)

Walter Roberson
Walter Roberson il 23 Gen 2020
cumsum(A, 1)

Sheharyar Mr
Sheharyar Mr il 23 Gen 2020
its working. can we do this from nested loop.

Community Treasure Hunt

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

Start Hunting!

Translated by