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
Adam
Adam 2019년 12월 12일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Shifting 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