Clear Filters
Clear Filters

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 views (last 30 days)
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?

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

No tags entered yet.

Products

Community Treasure Hunt

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

Start Hunting!