Reshape a multidimensional matrix keeping one size constant
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
alberto tonizzo
am 2 Mai 2022
Kommentiert: alberto tonizzo
am 2 Mai 2022
I have a matrix A of dimensions 5x6x5x25x91. How do I reshape it so the length of only 1 dimension (or 2 dimensions) is preserved?
Example for 1 dimension: 91 (last dimension of the original matrix A)
Example for 2 dimensions: 5x25 (middle dimensions of the original matrix A)
Thank you!
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 2 Mai 2022
reshape(A, [], 91)
reshape(A, [], 5, 25) %probably not what you want
reshape(A, 5, 25, []) %probably not what you want
reshape(A, size(A,1)*size(A,2), size(A,3), size(A,4), []) %might be what you want
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!