How to concatenate first column of matrix A and first column of matrix B, then second column of matrix A and second column of matrix B and so on?
조회 수: 1 (최근 30일)
이전 댓글 표시
A = rand(128,4626);
B = rand(128,4626);
I would like to concatenate A and B together, but in this format: C = [A(:,1) B(:,1) A(:,2) B(:,2) ... A(:,4626) B(:,4626)]
Is this possible?
댓글 수: 2
답변 (2개)
KSSV
2022년 3월 30일
A = rand(128,4626);
B = rand(128,4626);
[m,n] = size(A) ;
iwant = zeros(m,2*n) ;
iwant(:,1:2:end) = A ;
iwant(:,2:2:end) = B ;
댓글 수: 0
Bruno Luong
2022년 3월 30일
편집: Bruno Luong
2022년 3월 30일
A = randi(10,2,3)
B = randi(10,2,3)
reshape([A;B], size(A,1), [])
댓글 수: 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!