Converting cell to 3 dimensional matrix

53 views (last 30 days)
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

Accepted Answer

Stephen23
Stephen23 on 25 Feb 2017
Edited: Stephen23 on 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 Comments
Stephen23
Stephen23 on 22 Mar 2023
"And what if I want a50x11x2?"
permute(cat(3,C{:}),[3,1,2])

Sign in to comment.

More Answers (0)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!