Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
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

Antworten (2)

Azzi Abdelmalek
Azzi Abdelmalek am 27 Okt. 2014
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 am 27 Okt. 2014
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)

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by