This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Join matrices horizontally

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

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


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


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.


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:



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.

See Also

MuPAD Functions

Was this topic helpful?