English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Online Tools

MatLab Tutorial

Advanced Tutorial of MatLab-

  • MATLAB

  • GNU Octave Tutorial

MATLAB Matrix Concatenation

You can connect two matrices to create a larger matrix. The square brackets '[]' are the concatenation operator.

MATLAB allows two types of concatenation

Horizontal Concatenation-

When you connect two matrices by separating them with commas, they are simply horizontally appended. This is called horizontal concatenation. 10 12 23 Online Examples 14 8 6Online Examples 27 8 9Use the following code to create a script file
Or, if two matrices are separated by semicolons, they will be vertically appended. This is called vertical concatenation. 12 31 45 Online Examples 8 0 -9Online Examples 45 2 11Use the following code to create a script file
Example
a = [

b = [-

;
      10    12    23
      14     8     6
      27     8     9
]
      12    31    45
      8     0    -9
      45     2    11
c = [a, b]
      10    12    23    12    31    45
      14     8     6     8     0    -9
      27     8     9    45     2    11
d = [a; b]
      10    12    23
      14     8     6
      27     8     9
      12    31    45
      8     0    -9
      45     2    11