Effacer les filtres
Effacer les filtres

Changing Matrix dimensions from 4D to 2D: Matrix Manipulation, while preserving order of the data.

1 vue (au cours des 30 derniers jours)
Hello everyone, I would like some feedback, please, on how to change a matrix from 4D to 2D. The original Matrix is M: (5*5*14680*30) and I need to import it to excel so I can extract some data since I couldn't find a way to do it effectively in Matlab. The big dataset M is basically made up of 30 blocks of 14680 of 5*5 matrices. By changing its dimensions from 4D to 2D, I expect my new matrix to have the following dimensions: 73400*150 (that's 5*14680 row and 5*30 columns). The position of each 5*5 matrix along with every element in it has to stay intact. I attached a hand-drawn sketch to explain what I wrote.

Réponse acceptée

Matt J
Matt J le 17 Déc 2017
Modifié(e) : Matt J le 18 Déc 2017
newMatrix=reshape( permute(M,[1,3,2,4]) , [], 150);
  3 commentaires
James Tursa
James Tursa le 18 Déc 2017
Try inserting a comma
newMatrix=reshape( permute(M,[1,3,2,4]), [], 150);

Connectez-vous pour commenter.

Plus de réponses (1)

Matt J
Matt J le 17 Déc 2017
Modifié(e) : Matt J le 17 Déc 2017
newMatrix=cell2mat( reshape( num2cell(M,[1,2]) ,[],30) );

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by