Creating a new table with the same time value from 2 different tables
    7 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
Hello,
I have table t1 and t2 (attached) with the different sizes which has two columns (time,number). I want to create a new table if the time of table t1 and t2 are the same, and for the number, I want to have t2(number)+t1(number) with the coincided time.
Can someone help me?
0 commentaires
Réponse acceptée
  BA
      
 le 19 Jan 2023
        t1 = readtable('t1.xlsx'); %read table t1
t2 = readtable('t2.xlsx'); %read table t2
new_table = innerjoin(t1, t2, 'Keys', 'Var1'); %conduct an innerjoin with key var1
new_table.sum = new_table.Var2_t1 + new_table.Var2_t2; %add the two variables together
This is going to create a fourth variable in the table called sum. That is the var1+var2
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Data Type Identification dans Help Center et File Exchange
			
	Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

