MATLAB: Making a 341×341 matrix from a 465124×1 matrix.

generate new matrix from old matrix

Hello everybody,
I have a matrix that is 465124×1. From this matrix I want every 341 values put in another matrix. so the values from 1-341 is the first column and than the values from 342-683 is the second column etc. This should yield a 341×341 matrix.
It gives a 341×341 matrix but just with the values from 1-341 from the orginal matrix. Here is my code:
for i = 1:341:465124
for p = 1:1:341
a = i+340;
kolom(:,p) = value(i:a,1);
end
end
I do not know what i am doing wrong so please help.
Thank you!

Best Answer

Sounds like you are looking for the RESHAPE command.