Combining 3d matrices

20 visualizzazioni (ultimi 30 giorni)
Prodip Das
Prodip Das il 2 Apr 2019
Commentato: Matt J il 8 Lug 2021
I have in total 4 matrices each of size (m)x(n)x(p) .. Lets say these matrices are called a,b,c and d.
I need to combine them in such a way that I would get a resulting matrix of size 2m x 2n x 2p, with the 2m coming from a and b, 2n from a and c, and 2p from a and d.
I can get the corresponding 2m x n x p and etc. using cat(1,a,b), cat (2,a,c) etc, but am unable to figure out the rest (or if this is even the right direction). Any help is appreciated.
Thanks!

Risposte (1)

Matt J
Matt J il 2 Apr 2019
Modificato: Matt J il 2 Apr 2019
Your description doesn't define the new matrix well enough. The result will have 8 times as many entries, but you only have 4 matrices to draw data from, so it is not clear where all the additional entries will come from.
However, here is one of many possibilities,
L1=[a,c;b,c];
L2=[d,d;d,d];
result=cat(3,L1,L2);
  3 Commenti
Paulo Eduardo Beiral
Paulo Eduardo Beiral il 8 Lug 2021
Thank you, it helped me too!
Matt J
Matt J il 8 Lug 2021
I'm glad, but if so please Accept-click the asnwer.

Accedi per commentare.

Categorie

Scopri di più su Creating and Concatenating 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!

Translated by