Converting cell to 3 dimensional matrix

I have a cell of size [1, 50] each of it is 11 x 2 matrix.
I would like it to convert it to a 3-d matrix of size 11 X 2 X 50.
How it can be done? Cane it be done using reshape?
Thanks

 Akzeptierte Antwort

Stephen23
Stephen23 am 25 Feb. 2017
Bearbeitet: Stephen23 am 25 Feb. 2017

5 Stimmen

If C is your cell array:
cell2mat(permute(C,[1,3,2]))
or
cell2mat(reshape(C,1,1,[]))
or
cat(3,C{:})

2 Kommentare

Giovanni Bambini
Giovanni Bambini am 22 Mär. 2023
And what if I want a50x11x2?
"And what if I want a50x11x2?"
permute(cat(3,C{:}),[3,1,2])

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 25 Feb. 2017

Kommentiert:

am 22 Mär. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by