Navigation

Operators and Keywords

Function List:

C++ API

: cat (dim, array1, array2, …, arrayN)

Return the concatenation of N-D array objects, array1, array2, …, arrayN along dimension dim.

A = ones (2, 2);
B = zeros (2, 2);
cat (2, A, B)
 ⇒ 1 1 0 0
    1 1 0 0

Alternatively, we can concatenate A and B along the second dimension in the following way:

[A, B]

dim can be larger than the dimensions of the N-D array objects and the result will thus have dim dimensions as the following example shows:

cat (4, ones (2, 2), zeros (2, 2))
 ⇒ ans(:,:,1,1) =

      1 1
      1 1

    ans(:,:,1,2) =

      0 0
      0 0

See also: horzcat, vertcat.

Package: octave