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 次查看(过去 30 天)
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?

采纳的回答

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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

尚未输入任何标签。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by