FUNCTION REFERENCE

cat

Join arrays along a dimension.

Join arrays along a dimension.

Syntax

C = cat(dim, A, B, ...)

cat(1, ...) stacks arrays vertically, cat(2, ...) joins them side by side.

Numeric, logical and character inputs follow the same rules as [A, B] and [A; B].

Text joined with numbers gives text (cat(2, 'a', 66) is 'aB'); cat(1, 'ab', 'cd') is a

2-by-2 character array. Cell arrays join cell by cell; a non-cell input joined with

cells becomes one cell. cat(dim, A) returns A. Empty inputs are skipped when another

input is nonempty; when every input is empty their sizes must still agree.

Mismatched sizes give "Dimensions of matrices being concatenated are not consistent."

Example

cat(1, [1 2], [3 4])   % [1 2; 3 4]

Differences from MATLAB: dim 1 and 2 only (cat(3, ...) with one nonempty array returns it); N-dimensional

results are not supported yet. The leftmost integer class wins; single wins over double.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.