# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `linalg`::`concatMatrix`

Join matrices horizontally

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```linalg::concatMatrix(`A`, `B1`, <`B2, …`>)
```

## Description

```linalg::concatMatrix(A, B1, B2, dots )``` returns the matrix formed by joining the matrices A, B1, B2, … horizontally.

The matrices ```B1, B2, dots``` are converted into the matrix domain `Dom::Matrix(R)`, where `R` is the component ring of `A`.

An error message is raised if one of these conversions fails, or if the matrices do not have the same number of rows as the matrix `A`.

A short form of `linalg::concatMatrix` is available through the dot operator `.`, i.e., instead of `linalg::concatMatrix(A, B)` one may use the short form `A . B`.

## Examples

### Example 1

We define the matrix:

`A := matrix([[sin(x), x], [-x, cos(x)]])`

and append the 2×2 identity matrix to the right of `A`:

```I2 := matrix::identity(2): linalg::concatMatrix(A, I2)```

The short form for this operation is:

`A . I2`

### Example 2

We define a matrix from the ring of 2×2 square matrices:

```SqMatQ := Dom::SquareMatrix(2, Dom::Rational): A := SqMatQ([[1, 2], [3, 4]])```

Note the following operation:

`AA := A . A`

returns a matrix of a different domain type as the input matrix:

`domtype(AA)`

## Parameters

 `A`, `B1`, `B2, …` Matrices of a domain of category `Cat::Matrix`

## Return Values

Matrix of the domain type `Dom::Matrix``(R)`, where `R` is the component ring of `A`.