merge two csv files with a key

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일

0 개 추천

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');

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2020년 6월 10일

댓글:

2020년 6월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by