MATLAB: How to access n vector elements, then skip n elements, then access the following n elements and so on

elementsvector

I would like to access vector elements like this:
a_new = [a(1:10) a(21:30) a(41:50) ... ]
Is there any elegant way how to do that without loops?
The vector is huge, so something like
k=[];
n=10;
for i=1:floor(length(a)/n)
if mod(i,2)==0
kk=((i-1)*n):((i)*n);
k=[k kk];
end;
end;
a_new=a(k);
cannot be used.
Thanks, Michal

Best Answer

Assuming that the number of elements of your vector A is exactly divisible by 20:
M = reshape(A,20,[])
V = M(1:10,:)
V = reshape(V,1,[])
If required, pad/trim the vector A to make it a suitable length.