| Contents | Index |
C = vertcat(A1, A2, ...)
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.
vertcat also concatenates character strings. Each string being concatenated must have the same number of characters.
MATLAB calls C = vertcat(A1, A2, ...) for the syntax C = [A1; A2; ...] when any of A1, A2, etc. is an object.
For information on combining unlike integer types, integers with nonintegers, cell arrays with non-cell arrays, or empty matrices with other elements, see Combining Unlike Classes in the Programming Fundamentals documentation.
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| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |