Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
progressive sum of all elements

Subject: progressive sum of all elements

From: Patrick Diviacco

Date: 26 Sep, 2009 10:00:05

Message: 1 of 2

hi,

I have this array [1 2 2 1]
and I want the array with the progressive sum of all elements: [1 3 5 6]
How can I implement this in matlab ?

thanks

Subject: progressive sum of all elements

From: ImageAnalyst

Date: 26 Sep, 2009 10:48:02

Message: 2 of 2

On Sep 26, 6:00 am, "Patrick Diviacco" <patrick.divia...@gmail.com>
wrote:
> hi,
>
> I have this array [1 2 2 1]
> and I want the array with the progressive sum of all elements: [1 3 5 6]
> How can I implement this in matlab ?
>
> thanks

---------------------------------------------------
There is a "cumsum" function to do this.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us