MATLAB: Grouping matrices under a

matrix array

Hi,
So it is straight forward to do the following,
A = [2; 6; 7; 8; 6]
B = [7; 1; 6; 3; 4; 9; 8]
C= [A;B] = [2; 6; 7; 8; 6; 7; 1; 6; 3; 4; 9; 8]
Assume that I have several of these matrices that I need to "group". How can I write some code which will do the above but be flexible enough to recognise how many matrices I need to group (the number will vary).
Hope that makes sense.
Craig

Best Answer

vertcat(A,B)
If you have many arrays. For example
a=[]
for k=1:10
x=(1:k)'
a=vertcat(a,x)
end
%or
vertcat(a,b,c,d)