convert cell array of different size to 3d array

조회 수: 1 (최근 30일)
lucksBi
lucksBi 2017년 6월 11일
댓글: lucksBi 2017년 6월 11일
hi
i hv cell array of a large size and every cell contains different no. of elements. how to convert this into a 3d array. e.g. with 7x2 cell array:
array= {0,[11,12];[13,29],[2,5,6,8];0,[11,35,17];19,[12,6,29];33,[11,3,5,17];0,[11,7];[3,3],[5,1]}
3d array can look like this:
output(1,:,1)=0
output(1,:,2)=[11,12]
output(2,:,1)=[13,29]
output(2,:,2)=[2,5,6,8]
output(3,:,1)=0
output(3,:,2)=[11,35,17]
and same for all other rows. (1st value before semicolon is from 1st slice and 2nd is from 2nd slice)
Thanks.
  댓글 수: 2
Stephen23
Stephen23 2017년 6월 11일
"3d array can look like this:"
No, it can't. MATLAB does not support ragged arrays (because they are not a useful mathematical concept).
lucksBi
lucksBi 2017년 6월 11일
Ok is there any other way to convert this into 3d?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by