combine 2 matrices to 1 matrix?

조회 수: 4 (최근 30일)
Nimasha Pilippange
Nimasha Pilippange 2022년 2월 19일
편집: Nimasha Pilippange 2022년 2월 19일
I have 2 matrices as A=[ 1 2 3 4 5] and B= [ 6 7 8 9 10] , How can I combine them so I can get C=[1 6 2 7 3 8 4 9 5 10]. I need for a large matrix. But first I will start with a small matrix.
Can anyone help?

채택된 답변

Torsten
Torsten 2022년 2월 19일
편집: Torsten 2022년 2월 19일
N = numel(A);
C = zeros(2*N,1);
C(1:2:end-1) = A;
C(2:2:end) = B;
  댓글 수: 1
Nimasha Pilippange
Nimasha Pilippange 2022년 2월 19일
편집: Nimasha Pilippange 2022년 2월 19일
Thank you for the reply. It works fine.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by