Hello
Can someone help me, I need some help to this function: V=[e1,e2,e3,e4,e5....etc] e1 to etc are the values I will define for this function. As an example: V=[2,6,3,9,0,-10]
The function must return as: V=[e1,e1+e2,e1+e2+e3,e1+e2+e3+e4,e1+e2+e3+e4+e5....etc] As an example: V=[2,8,11,20,20,10]
I will appreciate any kinde of help

 Respuesta aceptada

Star Strider
Star Strider el 22 de Ag. de 2015

0 votos

The cumsum function does exactly what you want:
V=[2,6,3,9,0,-10];
Vr = cumsum(V)
Vr =
2 8 11 20 20 10

2 comentarios

Mathias Eriksen
Mathias Eriksen el 22 de Ag. de 2015
Thank you, it worked (Thumps up)
Star Strider
Star Strider el 22 de Ag. de 2015
My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 22 de Ag. de 2015

Comentada:

el 22 de Ag. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by