How to combine two matrix?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
dragoon
le 25 Oct 2015
Réponse apportée : Star Strider
le 25 Oct 2015
For example, I define matrix
A = ones(2,2,2)
and
B = ones(2,2,2)
I wish to combine A and B to form a new matrix C so that the size of C is 2,2,4 and C(:,:,1:2) = A and C(:,:,3:4)=B
How may I do it? I tried C = [A B] or C = [A,B] but none of them works
0 commentaires
Réponse acceptée
Star Strider
le 25 Oct 2015
Use the cat function:
A = randi(9,2,2,2);
B = randi(9,2,2,2);
C = cat(3, A, B);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!