Page 1 of 1
Running total in matlab
Posted: July 11th, 2006, 3:22 am
by asd
I have an array eg., x=[x1 ; x2 ; x3]I want to caculate running total arrayeg., y=[x1 ; x1+x2 ; x1+x2+x3]Can someone please suggest if there is some command or function to do this? (I am doing a loop now, and wondering if there is a better way)
Running total in matlab
Posted: July 11th, 2006, 4:38 am
by irvingy
QuoteOriginally posted by: asdI have an array eg., x=[x1 ; x2 ; x3]I want to caculate running total arrayeg., y=[x1 ; x1+x2 ; x1+x2+x3]Can someone please suggest if there is some command or function to do this? (I am doing a loop now, and wondering if there is a better way)cumsum() is the function you're looking for.
Running total in matlab
Posted: July 11th, 2006, 4:02 pm
by asd
Irvingy, Thanks a lot!