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

 採用された回答

Stephen23
Stephen23 2017 年 2 月 25 日
編集済み: Stephen23 2017 年 2 月 25 日

5 投票

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

2 件のコメント

Giovanni Bambini
Giovanni Bambini 2023 年 3 月 22 日
And what if I want a50x11x2?
Stephen23
Stephen23 2023 年 3 月 22 日
"And what if I want a50x11x2?"
permute(cat(3,C{:}),[3,1,2])

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrices and Arrays についてさらに検索

質問済み:

2017 年 2 月 25 日

コメント済み:

2023 年 3 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by