Azzera filtri
Azzera filtri

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 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Torsten
Torsten il 11 Ago 2017
Maybe
d = [a(:) b(:) c(:)]
?
Best wishes
Torsten.
  6 Commenti
Torsten
Torsten il 11 Ago 2017
Modificato: Torsten il 11 Ago 2017
Writing the transposed matrix as column vector does not work this way ?
Any recommendation ?
Best wishes
Torsten.
Torsten
Torsten il 11 Ago 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by