MATLAB: Deleting a unit dimension of a matrix unit dimension My matrix size is 1*250*500; How can I change this matrix into 250*500. Best Answer squeeze() if you want to delete all unit dimensions (provided that the matrix is at least 3d).permute() the dimension out of the way if you want to move a specific dimension.For example,M = rand(1,250,1,500);size(squeeze(M)) %gets rid of both 1's, leaving 250 x 500size(permute(M, [2 3 4 1]) %moves dimension 1 to the fourth dimension, leaving 250 x 1 x 500 x 1 but the trailing 1 is not displayed so 250 x 1 x 500 Related SolutionsMATLAB: How to multiply 7 x 1 matrix with 400 x 1 matrix It's matrix multiplication you can just transpose the matrix to match the rule of matrix multiplication:a=rand(400,1); %exampleb=rand(7,1);ab=a*b.'; % -> b transposed here, now the size of b is 1 by 7size(ab) % which will be 400 by 7 MATLAB: Delete a dimension from a 3d array to convert into a 2d array (Matrix) squeeze(yourarray)orpermute(yourarray, [2 3 1])squeeze is simpler and will get rid of all singleton dimensions. Related QuestionReshape 3d to 2d arrayGoing from 1 x n to n x n matrixHow to change M*1*N matrix to M*N matrixMatrix manipulationHow to convert a 1x1x50 matrix to a vector
Best Answer