Converting cell to 3 dimensional matrix

63 Ansichten (letzte 30 Tage)
Pankaj
Pankaj am 25 Feb. 2017
Kommentiert: Stephen23 am 22 Mär. 2023
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
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?
Stephen23
Stephen23 am 22 Mär. 2023
"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 Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by