fi objects horizontally
C = horzcat(
horzcat is equivalent to using square brackets for horizontally
concatenating arrays. For example,
[A B] is
are compatible arrays.
numerictype properties of a
concatenated matrix of
C, are taken
from the leftmost
fi object in the list
A— First input
First input, specified as a scalar, vector, matrix, or multidimensional array.
B— Second input
Second input, specified as a scalar, vector, matrix, or multidimensional array.
The elements of
B are concatenated to the end of the first input
along the second dimension. The sizes of the input arguments must be compatible. For
example, if the first input is a matrix of size 3-by-2, then
have 3 rows.
A1,A2,…An— List of inputs
List of inputs, specified as a comma-separated list of elements to concatenate in the order they are specified.
Any number of matrices can be concatenated within one pair of brackets. Multidimensional arrays are horizontally concatenated along the second dimension.
The inputs must have compatible sizes. For example, if
A1 is a
column vector of length m, then the remaining inputs must each have
m rows to concatenate horizontally.
Horizontal and vertical concatenation can be combined together, as in
The matrices in a concatenation expression can themselves be formed via a
concatenation, as in
[a b;[c d]].
[A B;C] is allowed if the number of rows of
equals the number of rows of
B and if the number of columns of
A plus the number of columns of
B equals the
number of columns of
When concatenating an empty array to a nonempty array,
omits the empty array in the output. For example,
ans = 1 2 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13