Concatenation Operator, Vertical:   //

matrix1 // matrix2 ;

The vertical concatenation operator (//) produces a new matrix by vertically joining matrix1 and matrix2. The matrices must have the same number of columns, which is also the number of columns in the new matrix. The number of rows in the new matrix is the number of rows in matrix1 plus the number of rows in matrix2.

For example, the following statements produce the matrix c, shown in Figure 24.7:

a = {1 1 1,
     7 7 7};
b = {0 0 0,
     8 8 8};
c = a//b;
print c;

Figure 24.7: Result of Vertical Concatenation

c
1 1 1
7 7 7
0 0 0
8 8 8


For character matrices, the element size of the result matrix is the larger of the element sizes of the two operands, as shown in Figure 24.8:

d = {"AB" "CD",
     "EF" "GH"};
e = {"I" "J",
     "K" "L",
     "M" "N"};
f = d//e;
print f;

Figure 24.8: Result of Vertical Concatenation

f
AB CD
EF GH
I J
K L
M N


You can use the vertical concatenation operator when one of the arguments has not been assigned a value. For an example, see the horizontal concatenation operator.