How do I add data from one table to another?
137 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Karim
il 12 Ago 2022
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 Commenti
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!