Converting cell to 3 dimensional matrix

조회 수: 63 (최근 30일)
Pankaj
Pankaj 2017년 2월 25일
댓글: Stephen23 2023년 3월 22일
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일
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개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by