Switch elements of the 2nd and 3d dimension in 3D matrix
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Consider a 3D array of dimensions i X j X k in the form:

Which is formed by repeating the i X j matrix for k times. I would like to switch the elements without using a loop to have a new iXkXj matrix of the form:

0 Commenti
Risposta accettata
michio
il 11 Set 2016
Have you tried permute function? http://www.mathworks.com/help/matlab/ref/permute.html I am guessing
B = permute(A,[1,3,2])
would do the job, where A is your original 3D matrix.
1 Commento
Philippa
il 6 Dic 2024
B = permute(A, [3,2,1]) according to the image result you shared.
but
B = permute(A,[1,3,2]) according to what you need for a i x k x j matrix
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!