Merging timeseries tables with different time values

조회 수: 15 (최근 30일)
Benju Baniya
Benju Baniya 2022년 8월 16일
답변: Rohit 2022년 8월 23일
I want to merge 2 time series tables (data attached). table1 has high frequency data (every 30 minutes). table2 has each day sunrise sunset data. I want to add the sunrise/sunset data to Table 1 such that I get the expected outcome. Because table 1 has every 30 minutes data, I will have to add the same data from table two 48 times in table1. I am having trouble writing the script becasue I am new to matlab. Please help.
Ecpected outcome:
Datetime Year DoY NEE Sunrise Sunset
20090101000000 2009 1 0.2345 736 1746
20090101003000 2009 1 1.2345 736 1746
20090101010000 2009 1 1.2455 736 1746
.......
....
20090102000000 2009 2 1.2455 737 1747
20090102000000 2009 2 1.2455 737 1747
  댓글 수: 2
dpb
dpb 2022년 8월 16일
Just like it's hard for you to type in data by hand, it's a pain for us to have to build trial datasets to illustrate code.
Attach .mat file which contains representative sample of each table.
Benju Baniya
Benju Baniya 2022년 8월 16일
Hi, I just added the data. Sorry about not adding it earlier.

댓글을 달려면 로그인하십시오.

답변 (1개)

Rohit
Rohit 2022년 8월 23일
Hi,
As per my understanding the "innerjoin" function can help to merge the tables. Please refer to command mentioned below that will merge the above tables in the required manner.
>> T = innerjoin(table2,table1);
It will map the "Sunrise" and "Sunset" value for every day in "table2" to each 30min data in "table1" for the corresponding day.
For more information, you can refer to the below documentation of "innerjoin" function.

카테고리

Help CenterFile Exchange에서 Time Series에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by