Add monthly value from one table to daily data in another table by matching month-year
4 次查看(过去 30 天)
显示 更早的评论
Hi, I have two tables
Table 1 are daily data and Table 2 are monthly data. I am trying to add the monthly value in Table 2 to all the days of that month in Table 1. I have been looking for hours now at examples on this forum using datetime etc to try and match the month and year, but cannot figure it out (I am a newbie). Basically I need to add 4.1193 (from Table 1) to 1-Apr-2013 to 30-Apr-2013 in Table 1, and then 4.8593 (from Table 2) to 1-May-2013 to 31-May-2013 in Table 1 etc. It's a common 'delta change' method so I know there's probably very simple code out there somewhere...
In summary, add Delta_MM for month X year X (Table 2) to all the TAIR values for the days/rows in that same month-year in Table 1. The end result will be a new daily timeseries of 2466 rows.
I had resorted to just going through and copy - pasting it month-by-month (pathetic, I know..), but I need to do this a few times with more data later so I realised I need help...
Can anybody help me please?
Thank you!
Table 1 (2466 x 2) Table 2 (360 x 2)
DateTime TAIR DateTime Delta_MM
01-Apr-2013 -7.5 01-Apr-2013 4.1193
02-Apr-2013 -2.9 01-May-2013 4.8593
03-Apr-2013 0.3 01-June-2013 -0.3856
etc etc etc etc
31-Dec-2019 -1.8 31-Dec-2019 -6.0221
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!