MATLAB: How can i reshape a 20370×1 matrix into 2037x10x1

reshape

I have tried to execute this using reshape and permute command.The problem is i am getting either the dimensions as 2037x1x10 or 2037×10. I want the dimension to be 2037x10x1. This is the solution i come up with so far,
>> r=permute(reshape(modu_data_QAM',2037,10),[2;3;1]);
The result= 10 1 2037
modu_data_QAM is a matrix of 20370×1 dimension.

Best Answer

MATLAB treats ALL matrices as having essentially an infinite number of trailing singleton dimensions. So a 2x3 matrix is really 2x3x1x1x1x1x1x1... Those trailing singleton dimensions are not reported by size or whos however.
X = zeros(2,3,1,1);
whos X
Name Size Bytes Class Attributes
X 2x3 48 double
size(X)
ans =
2 3
However, MATLAB indeed knows that X has trailing singleton dimensions. You can convince yourself of that easily enough.
size(X,3)
ans =
1
size(X,12)
ans =
1
Your 2037x10 matrix is indeed a 2037x10x1 matrix. So a simple reshape was all you needed to do.
B = reshape(A,[2037,10]);