COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

way to add and still show array?

• Email
• Follow

```This is what i want say i have a array that's 1-10 a=[1 2 3 4 5 6 7 8 9 10] transposed so it's all in column 1 but 10 rows. Is there a way to make a new array where the array would look like this...b=[1 3 6 10 15 21 28 36 45 55] so basically it's like this... b=a(1,1)+a(2,1)+a(3,1)...+a(10,1) but I want it to just go in a loop. Does this  make sense?
```
 0

See related articles to this posting

```On 10-08-25 02:06 PM, Tom wrote:
> This is what i want say i have a array that's 1-10 a=[1 2 3 4 5 6 7 8 9
> 10] transposed so it's all in column 1 but 10 rows. Is there a way to
> make a new array where the array would look like this...b=[1 3 6 10 15
> 21 28 36 45 55] so basically it's like this...
> b=a(1,1)+a(2,1)+a(3,1)...+a(10,1) but I want it to just go in a loop.
> Does this make sense?

Try cumsum()
```
 0

```"Tom " <TheGame0135@yahoo.com> wrote in message <i53piu\$kri\$1@fred.mathworks.com>...
> This is what i want say i have a array that's 1-10 a=[1 2 3 4 5 6 7 8 9 10] transposed so it's all in column 1 but 10 rows. Is there a way to make a new array where the array would look like this...b=[1 3 6 10 15 21 28 36 45 55] so basically it's like this... b=a(1,1)+a(2,1)+a(3,1)...+a(10,1) but I want it to just go in a loop. Does this  make sense?

help cumsum
```
 0

```"Tom " <TheGame0135@yahoo.com> wrote in message <i53piu\$kri\$1@fred.mathworks.com>...
> This is what i want say i have a array that's 1-10 a=[1 2 3 4 5 6 7 8 9 10] transposed so it's all in column 1 but 10 rows. Is there a way to make a new array where the array would look like this...b=[1 3 6 10 15 21 28 36 45 55] so basically it's like this... b=a(1,1)+a(2,1)+a(3,1)...+a(10,1) but I want it to just go in a loop. Does this  make sense?

Hi Tom, I think you just want cumsum()

a=[1 2 3 4 5 6 7 8 9 10];
b = cumsum(a);

Wayne
```
 0