필터 지우기
필터 지우기

a=1 2 3 4 5 6 7 8 9 b=0 1 1 2 3 2 3 2 1 resultant matrix is 1 0 2 1 3 1 4 2 5 3 6 2 7 3 8 2 9 1

조회 수: 3 (최근 30일)
kavitha subramaniam
kavitha subramaniam 2014년 10월 27일
편집: Matt J 2014년 10월 27일
a=1 2 3
4 5 6
7 8 9
b=0 1 1
2 3 2
3 2 1
How do I interleave columns?
resultant matrix is 1 0 2 1 3 1
4 2 5 3 6 2
7 3 8 2 9 1

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 10월 27일
a=[1 2 3; 4 5 6; 7 8 9]
b=[0 1 1; 2 3 2; 3 2 1]
[n,m]=size(a)
c=zeros(n,2*m)
c(:,1:2:end)=a
c(:,2:2:end)=b

Jan
Jan 2014년 10월 27일
a = [1 2 3; 4 5 6; 7 8 9];
b = [0 1 1; 2 3 2; 3 2 1];
c = reshape([a; b], 3, 6)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by