how to merge two tables with same column names into one table?
42 views (last 30 days)
Show older comments
I have two table with the same column names T1 and T2,
T1 = array2table(rand(4,3), 'VariableNames', {'A', 'B', 'C'})
T1 =
4×3 table
A B C
_______ _______ _______
0.3111 0.90488 0.25806
0.92338 0.97975 0.40872
0.43021 0.43887 0.5949
0.18482 0.11112 0.26221
T2 = array2table(rand(4,3), 'VariableNames', {'A', 'B', 'C'})
T2 =
4×3 table
A B C
_______ _______ ________
0.60284 0.29668 0.085516
0.71122 0.31878 0.26248
0.22175 0.42417 0.80101
0.11742 0.50786 0.02922
how can I merge them into one table T3?
T3 = merge(T1, T2)
T3 =
4×3 table
A B C
________________ _________________ __________________
0.3111 0.60284 0.90488 0.29668 0.25806 0.085516
0.92338 0.71122 0.97975 0.31878 0.40872 0.26248
0.43021 0.22175 0.43887 0.42417 0.5949 0.80101
0.18482 0.11742 0.11112 0.50786 0.26221 0.02922
0 Comments
Answers (1)
KSSV
on 10 May 2021
T1 = array2table(rand(4,3), 'VariableNames', {'A', 'B', 'C'}) ;
T2 = array2table(rand(4,3), 'VariableNames', {'A', 'B', 'C'}) ;
T = [T1 ;T2]
See Also
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!