trivial matrix question: how to rearrange matrices in a given order
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone,
I know this could seems trivial and meybe here we are talking about the very matlab basics, but as I am dealing with really big data structures, I would like to receive some support.
I have the following matrix, as shown in 1:
I would like to reshape it to be as in 2, and back again to point 1.
Thanks in advance
0 Commenti
Risposta accettata
Matt J
il 27 Apr 2023
Modificato: Matt J
il 27 Apr 2023
You can use blkColon in this FEX download,
>> X
X(:,:,1) =
1 10 19
2 11 20
3 12 21
X(:,:,2) =
4 13 22
5 14 23
6 15 24
X(:,:,3) =
7 16 25
8 17 26
9 18 27
>> Y=blkColon(X,[3,3])
Y =
1 10 19
2 11 20
3 12 21
4 13 22
5 14 23
6 15 24
7 16 25
8 17 26
9 18 27
2 Commenti
Più risposte (1)
chicken vector
il 27 Apr 2023
Modificato: chicken vector
il 27 Apr 2023
A = reshape(1:3^3,3^2,[])
B = permute(reshape(A',[],3,3),[2,1,3])
A = reshape(B,[],3)
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical 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!