MATLAB: How to shape a column vector into a matrix

column vector matrix

Hello everyone,
with the following code I calculate the mean of each of the 25 columns of a matrix and then order the resulting 1×25 array into a 5×5 matrix. The code is working but I was wondering if there is a shorter way to achieve the desired result.
meanv = mean(ERFF25USshort);
mat=ones(5,5);
mat(1,:) = meanv(1:5)
mat(2,:) = meanv(6:10)
mat(3,:) = meanv(11:15)
mat(4,:) = meanv(16:20)
mat(5,:) = meanv(21:25)
Thanks in advance!

Best Answer

mat = reshape(mean(ERFF25USshort),[5 5]).'