# How to merge 2 columnar matrices into a row matrix? [duplicate]

if i have two columnar matrices A,B . then how can i merge both matrices into a row matrix.

         A =  {-0.157681 - 0.0140601 I, 0.987384 + 0. I, 0.0000372277 - 0.00334827 I,-0.000272331 + 0.000439789 I}  ;
B =  {0.991357 + 0. I, -0.130103 - 0.0163991 I, -0.000272562 + 0.000624515 I, 0.0000254395 - 0.00390685 I } ;
Matrix = ( {{A, B}} )


Which gives me output

i want to know how to remove the brackets inside the matrix. and i also want to know whether removing of these brackets effect the matrix.? Thanks in advance

## marked as duplicate by Jason B., eldo, user9660, ilian, Dr. belisariusNov 20 '15 at 16:26

• Have you seen Join[]? – J. M. is away Nov 20 '15 at 14:31
• yes you are right dear , but Join [ A,B,2]; will solve it but , i want to some other methods – M.M Umber Nov 20 '15 at 14:36
• Then you should have mentioned it in your question to begin with, bub. – J. M. is away Nov 20 '15 at 14:37
• You can use Transpose[Flatten/@{A,B}], and I'm sure we could come up with an infinite number of convoluted variations. But why do you not want to use the method J.M. gave? If you have a particular performance goal in mind you might get better answers. – N.J.Evans Nov 20 '15 at 14:50
• LMAO @ bub. I can't help but notice you asked this question 2 hours ago and got two workable solutions in the comments – Jason B. Nov 20 '15 at 14:51

A = ({{-0.157681 - 0.0140601 I}, {0.987384 + 0. I}, {0.0000372277 -
0.00334827 I}, {-0.000272331 + 0.000439789 I}});
B = ({{0.991357 + 0. I}, {-0.130103 - 0.0163991 I}, {-0.000272562 +
0.000624515 I}, {0.0000254395 - 0.00390685 I}});


This is a good point to say that working with column vectors in Mathematica is more trouble than it is worth - you just don't need to do it most of the time. If your A and B were normal row vectors, then all you need is Transpose[{A,B}]. Here are ways that you can work with these column vectors to make a matrix.

Join[A, B, 2] // MatrixForm
ArrayFlatten[{{A, B}}] // MatrixForm
Transpose[Flatten /@ {A, B}] // MatrixForm
Thread[Flatten /@ {A, B}] // MatrixForm


And then, if you want to do it the old-timey way (this is how it feels when I have to work in Fortran)

AB = ConstantArray[0.0, {4, 2}];
For[i = 1, i <= 4, i++,
AB[[i, 1]] = A[[i, 1]];
AB[[i, 2]] = B[[i, 1]];
];
AB // MatrixForm


• Jason B Thanks for this value able but my input occur with single bracket around A,B. – M.M Umber Nov 20 '15 at 15:14
• Please Jason B see it again – M.M Umber Nov 20 '15 at 15:21
• And so how is Transpose[{A, B}] not working for you? – Jason B. Nov 20 '15 at 15:24
• :P it works Thanks a lot Dear – M.M Umber Nov 20 '15 at 15:26