I have a 1000x1 cell consisting of 20x20x20 complex doubles.
How do i convert it such that its 1000x20x20x20?
Tried using cell2mat but ended up with 20000x20x20x20.

 채택된 답변

KSSV
KSSV 2021년 3월 10일

0 개 추천

C{1} = rand(2,2,2) ;
C{2} = rand(2,2,2) ;
C{3} = rand(2,2,2) ;
C{4} = rand(2,2,2) ;
A = cat(4,C{:}) ;
C{1}
ans =
ans(:,:,1) = 0.0684 0.6500 0.4594 0.9694 ans(:,:,2) = 0.7593 0.4700 0.6565 0.9954
A(:,:,:,1)
ans =
ans(:,:,1) = 0.0684 0.6500 0.4594 0.9694 ans(:,:,2) = 0.7593 0.4700 0.6565 0.9954

댓글 수: 3

Shannon Lim
Shannon Lim 2021년 3월 10일
hi, i do not understand how this answers my question. I have a 1000x1 cell which ive attached. i would like to change it to an array of 1000x20x20x20 complex double
KSSV
KSSV 2021년 3월 10일
If C is you cell array of dimension 1x1000 with each cell 20*20*20, you can use the shown code and get A as 20*20*20*1000
Shannon Lim
Shannon Lim 2021년 3월 10일
that works. thank you!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2021년 3월 10일

댓글:

2021년 3월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by