merge two csv files with a key

7 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 6 月 10 日
コメント済み: alpedhuez 2020 年 6 月 11 日
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.

回答 (1 件)

Anish Walia
Anish Walia 2020 年 6 月 11 日
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 件のコメント
alpedhuez
alpedhuez 2020 年 6 月 11 日
Let me work on it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDownloads についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by