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

### merging two vectors

• Email
• Follow

```hello!

does anyonw know how can i merge two vectors together  for example:

a=[1 2 3 4 5]
b=[9 9 9 9 9]

i would like vector c =[1 9 2 9 3 9 4 9 5 9 ]

thanks
yafit
```
 0

See related articles to this posting

```On 02/01/11 2:13 AM, yafit maymon wrote:

> does anyonw know how can i merge two vectors together for example:
>
> a=[1 2 3 4 5]
> b=[9 9 9 9 9]
>
> i would like vector c =[1 9 2 9 3 9 4 9 5 9 ]

c = reshape([a;b], 1, [])
```
 0

```Nice Technique! But another alternative without using reshape fucntion is
>>c(1:2:10)=a;
>>c(2:2:10)=b

Yumnam Kirani Singh
Tronglaobi Awang Leikai

Walter Roberson <roberson@hushmail.com> wrote in message <ABXTo.24657\$My1.3393@newsfe16.iad>...
> On 02/01/11 2:13 AM, yafit maymon wrote:
>
> > does anyonw know how can i merge two vectors together for example:
> >
> > a=[1 2 3 4 5]
> > b=[9 9 9 9 9]
> >
> > i would like vector c =[1 9 2 9 3 9 4 9 5 9 ]
>
> c = reshape([a;b], 1, [])
```
 0