How to reshape the three dimensional array in 2D matrix?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sushil Pokharel
il 19 Lug 2022
Risposto: Bruno Luong
il 19 Lug 2022
Hi there, I want to reshape the 3D array into 2D matrix form:
for example: I have a matrix,
val(: ,: ,1) =
8 2
3 9
val(: ,: ,2) =
7 6
1 5
Now, I want to reshape this 3D array in the form of 2D matrix.
say A = [ 8 7
2 6
3 1
9 5 ]
Your help will be greatly appreciated.
Thank you.
0 Commenti
Risposta accettata
Più risposte (1)
Stephen23
il 19 Lug 2022
format compact
A = cat(3,[8,2;3,9],[7,6;1,5])
M = reshape(permute(A,[2,1,3]),4,2)
0 Commenti
Vedere anche
Categorie
Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!