| MATLAB Function Reference | ![]() |
Syntax
Description
C = vertcat(A1, A2, ...)
vertically concatenates matrices A1, A2, and so on. All matrices in the argument list must have the same number of columns.
vertcat concatenates N-dimensional arrays along the first dimension. The remaining dimensions must match.
MATLAB calls C = vertcat(A1, A2, ...) for the syntax C = [A1; A2; ...] when any of A1, A2, etc. is an object.
Examples
Create a 5-by-3 matrix, A, and a 3-by-3 matrix, B. Then vertically concatenate A and B.
A = magic(5); % Create 5-by-3 matrix, A A(:, 4:5) = [] A = 17 24 1 23 5 7 4 6 13 10 12 19 11 18 25 B = magic(3)*100 % Create 3-by-3 matrix, B B = 800 100 600 300 500 700 400 900 200 C = vertcat(A,B) % Vertically concatenate A and B C = 17 24 1 23 5 7 4 6 13 10 12 19 11 18 25 800 100 600 300 500 700 400 900 200
See Also
| version | view | ![]() |
© 1994-2005 The MathWorks, Inc.