How to combine two matrix?
조회 수: 2 (최근 30일)
이전 댓글 표시
For example, I define matrix
A = ones(2,2,2)
and
B = ones(2,2,2)
I wish to combine A and B to form a new matrix C so that the size of C is 2,2,4 and C(:,:,1:2) = A and C(:,:,3:4)=B
How may I do it? I tried C = [A B] or C = [A,B] but none of them works
댓글 수: 0
채택된 답변
Star Strider
2015년 10월 25일
Use the cat function:
A = randi(9,2,2,2);
B = randi(9,2,2,2);
C = cat(3, A, B);
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!