From: Chris on
I have vectors

W= E=
1 2 3 8
2 3 6 7
3 4 6 6
4 5 7 9

I want to make a vector that takes the first row of W then the first row of E
then the second row of W then second row of E.

when I use
combine = [W E] I get a super long vector that I don't want.

Any suggestions?
From: Pekka Kumpulainen on
"Chris " <ridered300tr(a)hotmail.com> wrote in message <hkghho$7sb$1(a)fred.mathworks.com>...
> I have vectors
>
> W= E=
> 1 2 3 8
> 2 3 6 7
> 3 4 6 6
> 4 5 7 9
>
> I want to make a vector that takes the first row of W then the first row of E
> then the second row of W then second row of E.
>
> when I use
> combine = [W E] I get a super long vector that I don't want.
>
> Any suggestions?

One that first came to my mind:
[m,n] = size(W);
combine = transpose(reshape([W';E'],n,2*m))
From: us on
"Chris " <ridered300tr(a)hotmail.com> wrote in message <hkghho$7sb$1(a)fred.mathworks.com>...
> I have vectors
>
> W= E=
> 1 2 3 8
> 2 3 6 7
> 3 4 6 6
> 4 5 7 9
>
> I want to make a vector that takes the first row of W then the first row of E
> then the second row of W then second row of E.
>
> when I use
> combine = [W E] I get a super long vector that I don't want.
>
> Any suggestions?

one of the many solutions

a=[
1 2
3 4
5 6
];
b=[
10 20
30 40
50 60
];
r=reshape([a,b].',2,[]).'
%{
1 2
10 20
3 4
30 40
5 6
50 60
%}

us