### 2.18 Join 2 matrices side-by-side and on top of each others

Mathematica

In Mathematica, to join 2 matrices side-by-side, use Join with '2' as the third argument. To join them one on top of the other, use '1' as the third argument

 a = RandomInteger[10, {3, 3}]  Out[146]= {{8,5, 1}, {8,10,8}, {6,0, 8}}  b = RandomInteger[10, {3, 3}]   {{9, 0,1}, {10,2,7}, {8, 0,8}}  (*join side-by-side as in Matlab [A B]*) Join[a, b, 2]   {{8,5, 1, 9,0,1}, {8,10,8,10,2,7}, {6,0, 8, 8,0,8}}  (*join vertically as in Matlab [A;B]*) Join[a, b, 1]   {{8, 5 , 1}, {8, 10, 8}, {6, 0 , 8}, {9, 0 , 1}, {10,2 , 7}, {8, 0 , 8}} 

 Matlab A=rand(3,3) B=rand(3,3) [A B]   0.5472 0.2575 0.8143 0.3500 0.6160 0.8308 0.1386 0.8407 0.2435 0.1966 0.4733 0.5853 0.1493 0.2543 0.9293 0.2511 0.3517 0.5497  [A;B]   0.5472 0.2575 0.8143 0.1386 0.8407 0.2435 0.1493 0.2543 0.9293 0.3500 0.6160 0.8308 0.1966 0.4733 0.5853 0.2511 0.3517 0.5497 

 Maple A:=ArrayTools:-RandomArray(3,3,distribution = uniform); B:=ArrayTools:-RandomArray(3,3,distribution = uniform); ; #side by side ; #on top of each others #or Matrix([A,B]); #side by side Matrix([[A],[B]]); #on top of each others