How to concatenate two matrices?

조회 수: 2 (최근 30일)
Ammy
Ammy 2021년 8월 21일
댓글: Ammy 2021년 8월 21일
I have two matrices
e.g.,
A=[1 2;3 4]
B=[5 6;7 8]
how to concatenate A and B such that
C=[1 2;5 6;3 4;7 8]

채택된 답변

Wan Ji
Wan Ji 2021년 8월 21일
A=[1 2;3 4];
B=[5 6;7 8];
C1 = [A,B]';
C = reshape(C1, size(A,2),numel(C1)/size(A,2))'
Then
C =
1 2
5 6
3 4
7 8
  댓글 수: 4
Wan Ji
Wan Ji 2021년 8월 21일
A=C(1:2:end,:);
B=C(2:2:end,:);
Ammy
Ammy 2021년 8월 21일
Thank you very much.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by