How to convert cell array to 3D array. I want to convert cell to mat

pu
pu(:,:,1) =
[5x9 double]
pu(:,:,2) =
[4x8 double]
pu(:,:,3) =
[4x7 double]
pu(:,:,4) =
[3x6 double]
du
du(:,:,1) =
[1x9 double]
du(:,:,2) =
[1x8 double]
du(:,:,3) =
[1x7 double]
du(:,:,4) =
[1x6 double]
cell2mat(pu,[],[])
Error using cell2mat
Too many input arguments.
du(:,:,:) = du{:,:,:}
Conversion to cell from double is
not possible.

댓글 수: 3

What would be the desired output size for converting pu?
For du we could speculate that you wanted to get out something that is 1 x 1 x (9+8+7+6), but there is no obvious conversion for pu
I don't have fixed array size...size is generating randomly. Can i view cell in screen. Instead of [1x8 double] i want to see values??

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

 채택된 답변

[a,b] = cellfun(@size,pu);
n = numel(pu);
out = zeros(max(a),max(b),n)
for jj = 1:n
out(1:a(jj),1:b(jj),jj) = pu{jj};
end

추가 답변 (0개)

카테고리

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

제품

질문:

2016년 1월 28일

댓글:

2016년 1월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by