Filling in gaps of missing data with a time series

43 visualizaciones (últimos 30 días)
drb17135
drb17135 el 17 de Nov. de 2021
Respondida: Star Strider el 17 de Nov. de 2021
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

Respuesta aceptada

Star Strider
Star Strider el 17 de Nov. de 2021
Change the table to a timetable (table2timetable), then use retime and the 'nearest' method.
.

Más respuestas (0)

Categorías

Más información sobre Timetables en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by