MATLAB: Combine 3x3D into 4D matrix combine 3d 4d I have 3 x 3D Matrixs of size (nrows x nfreqs x time) ie (5000 x 10 x 100) i want to combine them into a 4D matrix of size (5000 x 3 x 10 x 1000) ie the 5000 rows of 3D matrix are combined as 3 columns in the 4D matrix Best Answer Easiest:permute(cat(4,M1, M2, M3), [1 4 2 3])less memory perhaps:cat(2,reshape(M1, 5000, 1, 10, 100), reshape(M2, 5000, 1, 10, 100), reshape(M3, 5000, 1, 10, 100)) Related SolutionsMATLAB: How to reshape (digitTrain4DArrayData) inbuilt number dataset provided in MATLAB [XTrain,YTrain] = digitTrain4DArrayData;Use the reshape function as follows:reshapedXTrain = reshape(XTrain,784,5000); MATLAB: I have 5*10*9000 matrix. how can I average each 5*10 slices to get 9000 * 1 matrix. Please any helper? thanks See if this does what you want:M = rand(5,10,9000); % Create DataMR = reshape(M, [], size(M,3)); % Reshape To 2DOutput = mean(MR,1).'; % Result Related QuestionConverting a 2d matrix into a 3d matrixI want to create an average 2d field every 10 timesteps within a 3d matrix (6000 x 100 x100) –> (600 x 100 x100)How to create this vector [ 10 9 10 9 …] with one commandMethod of subtracting a number from a three-dimensional matrix
Best Answer