MATLAB: Help with vectors MatLab

vectors

Hello!
I have a vector
H =
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
I want it to be like
H= 0 1 0 1 0 1 0 1 0 1 0 1......
I tried with H(:) but it wont work, there is 17 zeros and 16 ones is that maybe a problem? Hope someone can help me . Kind regards

Best Answer

H2 = H;
H2([1:2:end,2:2:end])=H;
this is the solution !