From: Jose on
Hello to everyone, i have got this vector and i want to split it in blocks 0f 3 elements:


noise = 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1


round(length(noise)/3)=9


x=reshape(noise(1:27),9,[])

x =

1 1 0
1 1 0
1 1 0
1 0 1
0 0 1
0 0 1
0 1 1
1 1 1
1 1 1

But the problem is that i am interested in this vector:

x' =111
100
011
111
000
111
000
111
111

How can transform x in x'?

Thanks in advance.
From: jrenfree on
On Jun 11, 2:09 pm, "Jose " <jose.l.v...(a)gmail.com> wrote:
> Hello to everyone, i have got this vector and i want to split it in blocks 0f 3 elements:
>
> noise = 1     1     1     1     0     0     0     1     1     1     1     1     0     0     0     1     1     1     0     0     0     1     1     1     1     1     1     1
>
> round(length(noise)/3)=9
>
>  x=reshape(noise(1:27),9,[])
>
> x =
>
>      1     1     0
>      1     1     0
>      1     1     0
>      1     0     1
>      0     0     1
>      0     0     1
>      0     1     1
>      1     1     1
>      1     1     1
>
> But the problem is that i am interested in this vector:
>
> x' =111
>       100
>       011
>       111
>       000
>        111
>        000
>        111
>        111
>
> How can transform x in x'?
>
> Thanks in advance.

This seems to do it:

reshape(noise(1:27), 3, [])'