MATLAB: Convert matrix size from 1xmxn to mxn

squeeze

I want to compare two matrices. One's size is mxn and the other matrix size 1xmxn. How can I convert 1xmxn to mxn??

Best Answer

Z = randi(250,1,3,4); % your matrix
one way
out = squeeze(Z)';
other
out = permute(Z,[3 2 1]);
or
out = reshape(Z,size(Z,2),[])';