| MATLAB Function Reference | ![]() |
Syntax
Description
C = horzcat(A1,A2,...)
horizontally concatenates matrices A1, A2, and so on. All matrices in the argument list must have the same number of rows.
horzcat concatenates N-dimensional arrays along the second dimension. The first and remaining dimensions must match.
MATLAB calls C = horzcat(A1,A2,...) for the syntax C = [A1 A2 ...] when any of A1, A2, etc. is an object.
Examples
Create a 3-by-5 matrix, A, and a 3-by-3 matrix, B. Then horizontally concatenate A and B.
A = magic(5); % Create 3-by-5 matrix, A A(4:5,:) = [] A = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 B = magic(3)*100 % Create 3-by-3 matrix, B B = 800 100 600 300 500 700 400 900 200 C = horzcat(A,B) % Horizontally concatenate A and B C = 17 24 1 8 15 800 100 600 23 5 7 14 16 300 500 700 4 6 13 20 22 400 900 200
See Also
| home | hsv2rgb | ![]() |