Calculates the concatentation of two matrices.