concatenate vertically along the 3rd dimension of a matrix
조회 수: 38 (최근 30일)
이전 댓글 표시
I have a matrix which has these 3rd dimensions. A(:,:,1), A(:,:,2), A(:,:,3)
Now, I wanted these three to be vertically concatenated .
I know this: vertcat(A(:,:,1), A(:,:,2), A(:,:,3));
I wanted to know other solutions as the no.of 3rd dimensions seem to change for every loop.
Thanks
댓글 수: 0
답변 (3개)
Guillaume
2016년 7월 14일
splitA = num2cell(A, [1 2]); %split A keeping dimension 1 and 2 intact
vertcat(splitA{:})
댓글 수: 2
Image Analyst
2016년 7월 14일
Not sure what you mean by saying you have a matrix with these planes along the third dimension A(:,:,1), A(:,:,2), A(:,:,3)? They are already along the third dimension. For example they could be the red, green, and blue color channels of an RGB image. To concatenate 2d arrays along the third dimension, so
array3d = cat(3, array2da, array2db, array2dc, array2dc, .....);
for as many 2D arrays as you have.
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!