How can I put two tables into one?

Hey,
This seems like a simple thing but I couldn't do it yet. How can I join two tables with the same column names? Example: Join the two first tables to become like the third one.

 Accepted Answer

You can vertically concatenate them just as you would any other array:
Apple = [1 2 3]';
Banana = [4 5 6]';
T1 = table(Apple, Banana)
Apple = [9 8 7]';
Banana = [8 9 10]';
T2 = table(Apple, Banana)
T12 = [T1; T2]
Apple Banana
_____ ______
1 4
2 5
3 6
T2 =
Apple Banana
_____ ______
9 8
8 9
7 10
T12 =
Apple Banana
_____ ______
1 4
2 5
3 6
9 8
8 9
7 10

More Answers (0)

Categories

Asked:

IZ
on 27 Feb 2017

Answered:

on 27 Feb 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!