From: Gerry on
Hello,

I am new in Matlab and I don't know how to add an element to the next element in my vector (i+1). I tried several loops but couldn't make them work.

Here is an example:

A=[2 2 2 2];

I want "B" to be:

B=[2 4 6 8]

My vectors are actually thousands long, so I need a method to easily create such kind of "continuous" vectors. I will really appreciate any help about this.

Gerry
From: Walter Roberson on
Gerry wrote:

> I am new in Matlab and I don't know how to add an element to the next
> element in my vector (i+1).

cumsum()
From: Gerry on
Walter Roberson <roberson(a)hushmail.com> wrote in message <hk2tlj$4hp$1(a)canopus.cc.umanitoba.ca>...
> Gerry wrote:
>
> > I am new in Matlab and I don't know how to add an element to the next
> > element in my vector (i+1).
>
> cumsum()


Walter, Thanks a million!!

-gerry