simple way of matrix array resorting

I have three matrix, A, B, and C.
A = [a1 a2 a3 ...], B = [b1 b2 b3 ...], C = [c1 c2 c3 ...]
I want to create a matrix Q which look like
a1 b1 c1
a2 b2 c2
a3 b3 c3
...
What's simplist code?
Thank you.

 採用された回答

Stephen23
Stephen23 2019 年 12 月 12 日

1 投票

Robust:
Q = [A(:),B(:),C(:)]

その他の回答 (2 件)

Guillaume
Guillaume 2019 年 12 月 12 日

0 投票

Assuming your 3 vectors are row vectors (i.e. 1xN), then
result = [A; B; C].' %vertically concatenate then transpose

1 件のコメント

Hyun-su Kim
Hyun-su Kim 2019 年 12 月 12 日
It gives me 1xn matrix... sorry

サインインしてコメントする。

Adam
Adam 2019 年 12 月 12 日

0 投票

Q = [A', B', C'];

1 件のコメント

Hyun-su Kim
Hyun-su Kim 2019 年 12 月 12 日
I want to have a 3xn matrix.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

質問済み:

2019 年 12 月 12 日

コメント済み:

2019 年 12 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by