Reshaping 4d array into 2d matrix with a specific pattern
Ältere Kommentare anzeigen
Hello, can someone please help in reshaping/permuting an array?
Say I have a 4d array called tempC, indexed by (n, j, i, k), in which n and i have dimension 3, j and k have dimension 2.
I want to reshape this into a square matrix C that is N*J by I*K, or 6 x 6
The reshaping pattern should be like this:
1111 1112 1121 1122 1131 1132
1211 1212 1221 1222 1231 1232
2111 2112 2121 2122 2131 2132
2211 2212 2221 2222 2231 2232
3111 3112 3121 3122 3131 3132
3211 3212 3221 3222 3231 3232
Intuitively, n-j pairs correspond to rows, i-k pairs correspond to columns. We go through all j's for a given n first, likewise for all k's for a given i.
I am trying so many combinations with permute, and none seem to work...
How would I make this work?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!