Filter löschen
Filter löschen

my question is if a=[1 2;3 4],b=[5 6;7 8],c=[9 10;11 12] the resultant matrix should be d=[1 5 9;2 6 10;3 7 11;4 8 12] this should be done using for loop?

9 Ansichten (letzte 30 Tage)
my question is if a=[1 2;3 4],b=[5 6;7 8],c=[9 10;11 12]
the resultant matrix should be d=[1 5 9;2 6 10;3 7 11;4 8 12] this should be done using for loop?

Akzeptierte Antwort

Torsten
Torsten am 11 Aug. 2017
Maybe
d = [a(:) b(:) c(:)]
?
Best wishes
Torsten.
  6 Kommentare
Torsten
Torsten am 11 Aug. 2017
Bearbeitet: Torsten am 11 Aug. 2017
Writing the transposed matrix as column vector does not work this way ?
Any recommendation ?
Best wishes
Torsten.
Torsten
Torsten am 11 Aug. 2017
Don't know "Julia", but a combination of both features (.' and (:)) in one command line is quite intuitive.
Less cumbersome than
a=a.';
b=b.';
c=c.';
d=[a(:) b(:) c(:)];
Best wishes
Torsten.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

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

Tags

Noch keine Tags eingegeben.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by