MATLAB: Fill in a data vector into a preallocated zeros matrix

matrix

Hi,
I have a vector (called v) of size
[2000004×1 double]
with data, and I want to split this into a preallocated 500001×4 matrix (called m). The data needs to be extracted cronologically meaning that v(1,1) = m(1,1) and v(500002,1)=m(1,2)
Can anyone help?

Best Answer

m = reshape(v,500001,4);
Related Question