Concatenate arrays along specified dimension
C = cat(dim, A, B)
C = cat(dim, A1, A2, A3, A4, ...)
C = cat(dim, A, B)
concatenates
the arrays A
and B
along array
the dimension specified by dim
. The dim
argument
must be a real, positive, integer value.
C = cat(dim, A1, A2, A3, A4, ...)
concatenates
all the input arrays (A1
, A2
,
A3
, A4
, and so on) along array
dimension dim
.
For nonempty arrays, cat(2, A, B)
is the
same as [A, B]
, and cat(1, A, B)
is
the same as [A; B]
.
If your input arrays are tables or timetables, dim
must
be either 1 or 2. cat
then concatenates by calling horzcat
or vertcat
respectively.
Given
A = B = 1 2 5 6 3 4 7 8
concatenating along different dimensions produces
The commands
A = magic(3); B = pascal(3); C = cat(4, A, B);
produce a 3-by-3-by-1-by-2 array.
char
| horzcat
| num2cell
| reshape
| shiftdim
| special character
| squeeze
| strcat
| strjoin
| vertcat