MATLAB: Extract columns in a loop

extractloop

Hello, I am trying to extract every 2000 rows in a 20000 row column and place each extracted matrix into a separate column to create a 2000×10 matrix. However, I am getting an error: In an assignment A(:) = B, the number of elements in A and B must be the same. Any ideas?
Test=zeros(2000,10);
for w=1:10
Test(w)=zt3((2000.*(w-1))+1:2000.*w,1:1)
end

Best Answer

Is this what you want to do?
zt3 = [1:20000]'; %assuming zt3 is a 20000x1 matrix
Test = reshape(zt3, 2000, 10);
%Takes row 1:2000, 2001:4000, etc and stores each in a column in a new matrix.