How to combine several cell arrays into one cell array?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello every one,
I have 4 cell arrays as given below
H = 20*4*4 cell array
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/513562/image.png)
G = 40*8*4 cell array
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/513567/image.png)
Q = 20*4*8 cell array where Q(:,:, 1:4) are all zeros.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/513572/image.png)
F = 40*8*8 cell array where F(:,:,1:4) are all zeros.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/513577/image.png)
I want to put all these cells in one 40*8*8 cell arrays, called C, such that the
C(1:20, 1:4 ,1:4) = H
C(21:40, 5:8, 1:4) = G(21:40, 5:8, 1:4)
C(1:20, 1:4, 5:8) = Q(1:20, 1:4, 5:8)
C(21:40, 5:8, 5:8) = F(21:40, 5:8, 5:8)
Any idea how can I do that?Thanks in advance!
댓글 수: 2
Walter Roberson
2021년 2월 8일
C(1:20, 1:4 ,1:4) = H;
C(21:40, 5:8, 1:4) = G(21:40, 5:8, 1:4);
C(1:20, 1:4, 5:8) = Q(1:20, 1:4, 5:8);
C(21:40, 5:8, 5:8) = F(21:40, 5:8, 5:8);
looks plausible. What difficulty did you encounter?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!