joining two columns in a way of row by row

1 回表示 (過去 30 日間)
Jagadesh Rao
Jagadesh Rao 2014 年 10 月 28 日
回答済み: Hiba iqbal 2018 年 4 月 4 日
Hi, i have a doubt in matlab. Please help me.
If i have A=[1;2;3;4;5] and B = [6;7;8;9;10] i need C = [1;6;2;7;3;8;4;9;5;10] it should work no matter what the numbers are and how big the matrix is.
Thanks please reply.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 10 月 28 日
編集済み: Azzi Abdelmalek 2014 年 10 月 28 日
A=[1;2;3;4;5]
B = [6;7;8;9;10]
C=[A B]'
C=C(:)
% or
C=reshape([A B]',[],1)
  2 件のコメント
Jagadesh Rao
Jagadesh Rao 2014 年 10 月 28 日
Thankyou so much. see you again.
Jagadesh Rao
Jagadesh Rao 2014 年 11 月 2 日

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

その他の回答 (1 件)

Hiba iqbal
Hiba iqbal 2018 年 4 月 4 日
a = [1,2,3,4,5]; b = [6,7,8,9,10]; c = [a(:) b(:)] c = 1 6 2 7 3 8 4 9 5 10

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by