How to populate complete time series with incomplete data
4 次查看(过去 30 天)
显示 更早的评论
I have time series data with skipped periods that I wish to place onto a complete time stamp array. Rather than mm/dd format I have 'year' 'day of year (DOY)' and 'HHMM' 'Var1' like so
data=
2015 59 30 -31.42
2015 59 100 -31.21
2015 59 130 -31.06
2015 59 700 -30.9
2015 59 730 -30.38
2015 59 800 -30.07
2015 59 830 -29.83
2015 59 900 -29.69
2015 59 930 -29.53
2015 59 1000 -29.27
2015 59 1500 -26.11
2015 59 1530 -26.09
By comparing 'data' with a complete time series array 'full', I can get an 'index' value for missing periods, but I can't figure out how to bring the data (Var 1 etc) with it.
index = ismember( full(:, 3), data(:,3));
Only how to overlay the full set with NaN values for missing indices
fullindex = [index index index];
full(~fullindex)=nan;
Similar to this post http://www.mathworks.com/matlabcentral/answers/175089#answer_166928 but I can't use the 'datenum()' approach since I have DOY and different time stamps.
0 个评论
采纳的回答
Chad Greene
2016-1-21
You can get a vector in datenum format by
t = datenum(YEAR,1,DOY);
and if you'd like you can get t into year, month, day by
[year,month,day] = datevec(t);
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!