Reshaping a 2 d matrix into a 3 d matrix row wise.
Afficher commentaires plus anciens
Hello, and thanks for taking the time to read this:
I have a 100 x 99 matrix of ratings. I would like to reshape the matrix into a 9x11x100 array where the first row represents the first 9 horizsontal items of the first row. Byu way of a smaller example, imagine the data were:
7 6 5 4 5 6
1 5 6 6 6 2
1 6 6 6 6 1
5 5 6 6 7 2
I would like the result to be:
765
456
156
662
556
672
Can anyone please help with this?
Réponse acceptée
Plus de réponses (1)
Daniel Vieira
le 21 Fév 2020
A=randi(10,100,99); % example of what your matrix might be
B=permute(reshape(A',9,11,[]),[2 1 3]) % solution
1 commentaire
Russ
le 21 Fév 2020
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!