Concatenation is the process of joining arrays to form larger arrays. In fact, the first array is formed by concatenating its elements. Pairs of square brackets [] are concatenation operators.

A = [a,a]

A = 3×6
     1     3     5     1     3     5
     2     4     6     2     4     6
     7     8    10     7     8    10

Concatenating arrays next to each other using commas is called horizontal concatenation. Each array must have the same number of rows. Likewise, semicolons can be used for vertical concatenation if the arrays have the same number of columns.

A = [a; a]

A = 6×3
     1     3     5
     2     4     6
     7     8    10
     1     3     5
     2     4     6
     7     8    10
Comments