Filling in gaps of missing data with a time series

47 ビュー (過去 30 日間)
drb17135
drb17135 2021 年 11 月 17 日
回答済み: Star Strider 2021 年 11 月 17 日
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

採用された回答

Star Strider
Star Strider 2021 年 11 月 17 日
Change the table to a timetable (table2timetable), then use retime and the 'nearest' method.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTimetables についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by