Effacer les filtres
Effacer les filtres

merge two csv files with a key

9 vues (au cours des 30 derniers jours)
alpedhuez
alpedhuez le 10 Juin 2020
Commenté : alpedhuez le 11 Juin 2020
I have two csv files. One file has date and temperature. Anothe file has date and rainfall. I want to combine two files using date as a key. Please advise.

Réponses (1)

Anish Walia
Anish Walia le 11 Juin 2020
Assuming files are names file1 and file 2
table1 = readtable('file1.csv');
table2 = readtable('file2.csv');
%variable name of the column to use as key to join should be same in both tables (data in your case)
mergedTable = join(table1,table2);
% mergedTable contains the combined table
writetable(mergedTable,'MergedTables.csv');
  1 commentaire
alpedhuez
alpedhuez le 11 Juin 2020
Let me work on it.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Tags

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by