Skip to content

horzcat

Horizontal concatenation ([A, B]).

C = horzcat(A, B)
C = horzcat(A, B, ...)

Concatenates arrays horizontally — equivalent to [A, B] syntax. All inputs must have the same number of rows (or the same size in every dimension other than 2).

horzcat([1; 2], [3; 4]) % [1 3; 2 4]
horzcat(eye(2), zeros(2)) % 2×4
  • vertcat — Vertical concatenation ([A; B]).
  • cat — Concatenate arrays along a specified dimension.
  • blkdiag — Block-diagonal matrix from input matrices.