how to stack 2 dimensional arrays into 3 dimensional aarays?

I have Nine(9) , 2-D arrays of size 3200x8.
I want to stack them into a 3D array so that I could have a final aaray of size 3200x8x9.
Please help!

2 commentaires

See this: cat
Concatenating arrays does not change dimenions it only concatenates arrays and matrices

Connectez-vous pour commenter.

 Réponse acceptée

If 2D arrays are stored in 9 variables
cat(3,A1,A2,A3,A4,A5,A6,A7,A8,A9);
If they are stored in 1x9 cell C
cat(3, C{:});

Plus de réponses (1)

darova
darova le 28 Août 2019
Use cat()

4 commentaires

Concatenating arrays does not change dimenions it only concatenates arrays and matrices
"Concatenating arrays does not change dimenions..."
Which is not what you describe in your question.
"... it only concatenates arrays and matrices"
Which is exactly what you describe in your question.
I have Nine, 2D arrays of dimesnions 3200x8, and I want them to change a single 3D array of size 3200x8x9.
Stephen23
Stephen23 le 28 Août 2019
Modifié(e) : Stephen23 le 28 Août 2019
"I have Nine, 2D arrays of dimesnions 3200x8, and I want them to change a single 3D array of size 3200x8x9."
Sure, use cat.

Connectez-vous pour commenter.

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by