How do I add data from one table to another?
조회 수: 144 (최근 30일)
이전 댓글 표시
I have two tables of different sizes.
Table 1 is of size 1x28
Table 2 is of size 6x28
First table consists of the varibale names and the second table consists of the values of those variables. How do I copy the values from the second table and paste them below the variable names in the first table?
Final table size should be 7x28
Thanks in advance for your support
댓글 수: 0
답변 (1개)
Karim
2022년 8월 12일
Hello, you can simply append the tables, see below for an example
Var1 = ["A";"B";"C";"D";"E"];
Var2 = [1;2;3;4;5];
Var3 = logical([1;0;1;0;1]);
Var4 = [10;20;30;40;50];
Var5 = rand(5,1);
T1 = table(Var1,Var2,Var3,Var4,Var5)
Var1 = ["F";"G";"H"];
Var2 = [6;7;8];
Var3 = logical([0;1;0]);
Var4 = [60;70;80];
Var5 = rand(3,1);
T2 = table(Var1,Var2,Var3,Var4,Var5)
% merge the tables
T = [T1;T2]
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!