4

So I want to be able to put matrices "next to each other", or in other words if I have two matrices $A$ that is $n\times k$ and $B$ that is $n\times m$, I want to be able to create a matrix $C$ that is $n\times (k+m)$ so that the $(k+1)$th column of $C$ is the first column of $B$.

This should be really easy, and in matlab it is (C= [A B]), but I can't figure it out in mathematica

Sertii
  • 135
  • 7

1 Answers1

4

Like this?

(a = ConstantArray["A", {4, 3}]) // MatrixForm

enter image description here

(b = ConstantArray["B", {4, 4}]) // MatrixForm

enter image description here

Map[Flatten, Transpose[{a, b}]] // MatrixForm

enter image description here

eldo
  • 67,911
  • 5
  • 60
  • 168