joining two columns in a way of row by row

1 view (last 30 days)
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.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 28 Oct 2014
Edited: Azzi Abdelmalek on 28 Oct 2014
A=[1;2;3;4;5]
B = [6;7;8;9;10]
C=[A B]'
C=C(:)
% or
C=reshape([A B]',[],1)

More Answers (1)

Hiba iqbal
Hiba iqbal on 4 Apr 2018
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

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!