Filling in gaps of missing data with a time series
27 views (last 30 days)
Show older comments
Hi, I have a set of data that ranges from two date times and has data allocated to each time. I am looking to replace any missing time data points with the nearest neighbour method.
this is what I have so far:
CI_pre = string(readcell('CarbonIntensityCombined.xlsm', 'Sheet','JantoDec_2022-2024','Range','A2:A52609'));
CI_pre = split(CI_pre,{'T',':','Z'});
CI_pre = join(CI_pre);
CI2 = replaceBetween(CI_pre,14,14,':');
CI_check = datetime(c2);
% % create an array of datetime ranging from 1/1/2022 to 31/12/24
% increasing in 30 minute increments
T1_CI = daHi, I have a set of data that ranges from two date times and has data allocated to each time. I am looking to replace any missing time data points with the nearest neighboutetime('2022-01-01 00:00:00');
T2_C2 = datetime('2024-12-31 23:30:00');
t= (T1_CI:minutes(30):T2_C2)';
% check there is no missing days in the data´
idx = ismember(CI_check,t);
CImissing = t(~idx);
the CI_check data looks like this:
'01-Jan-2022 00:00:00'
'01-Jan-2022 00:30:00'
'01-Jan-2022 01:00:00'
'01-Jan-2022 01:30:00'
and so on (incresing in 30 minutes)
and the data associated with it are just numbers
if there is missing data how do I retime this and replace the values with the nearest neighbour method?
I am aware I might need to use retime or make a timetable but I keep getting errros.
Thanks
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Timetables in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!