cat
Concatenate arrays
Description
C = cat(
concatenates dim
,A1,A2,…,An
)A1
, A2
, … , An
along
dimension dim
.
You can use the square bracket operator []
to concatenate or append
arrays. For example, [A,B]
and [A B]
concatenates
arrays A
and B
horizontally, and [A;
B]
concatenates them vertically.
Examples
Input Arguments
Tips
Algorithms
When concatenating an empty array to a nonempty array, cat
omits the
empty array in the output. For example, cat(2,[1 2],[])
returns the row
vector [1 2]
.
If all input arguments are empty and have compatible sizes, then cat
returns an empty array whose size is equal to the output size as when the inputs are nonempty.
For example, cat(2,zeros(0,1),zeros(0,2))
returns a 0-by-3 empty
array.
Extended Capabilities
Version History
Introduced before R2006a