Converting cell to 3 dimensional matrix

65 visualizaciones (últimos 30 días)
Pankaj
Pankaj el 25 de Feb. de 2017
Comentada: Stephen23 el 22 de Mzo. de 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

Respuesta aceptada

Stephen23
Stephen23 el 25 de Feb. de 2017
Editada: Stephen23 el 25 de Feb. de 2017
If C is your cell array:
cell2mat(permute(C,[1,3,2]))
or
cell2mat(reshape(C,1,1,[]))
or
cat(3,C{:})
  2 comentarios
Giovanni Bambini
Giovanni Bambini el 22 de Mzo. de 2023
And what if I want a50x11x2?
Stephen23
Stephen23 el 22 de Mzo. de 2023
"And what if I want a50x11x2?"
permute(cat(3,C{:}),[3,1,2])

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by