General array concatenation can be done through the array concatenation operator cat(k, A, B, C, ...) that concatenates the arrays A, B, C, .... along the k:th dimension. Concatenating along the first dimension is to concate rows and the second dimension is to concatenate colums.
A matrix can be constructed from scalar expressions by separating rows by semicolon and columns by comma. The previous example of concatenation along the second dimension can be expressed like this:
The arrays that is concatenated must have the same number of dimensions. The concatenation dimension k must exist. Arrays must have identical dimension sizes with the exception of the size of dimension k, which is called Size matching. Argument arrays must have equivalent maximally expanded element types. The element type of the result array is the element type of the maximally expanded type of the arguments. These rules make it possible to mix integers and real numbers as in the example below: