Average sections of a timetable
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Poison Idea fan
el 22 de Mzo. de 2023
Editada: Cris LaPierre
el 22 de Mzo. de 2023
I have a data timetable. One of the variables is a flag that determines sample time and background time. For the purposes of my data processing, I want to average the sample times to 1 minute intervals.
Currently, I extract the rows with filterstate == 0 and use retime, then I concatenate the timetables and sort the rows in time. This creates an artifact where the first sample time will be rounded to the previous minute and creates a data processing issue.
Is there a better way to do this, or could I specify in retime to round to the next minute?
load example_tt.mat
% EDIT to show raw data
example_tt(6612:6635,:)
example_avg = retime_sample(example_tt);
example_avg(885:910,:)
function [raw_TT_retimed] = retime_sample(raw_TT)
% Take a raw data timetable and convert the sample times to 1 minute
% averages
sample_times = raw_TT(raw_TT.('filter state') == 0,:);
sample_times = retime(sample_times,"regular",'mean','TimeStep',minutes(1));
raw_TT_retimed = [sample_times;raw_TT(raw_TT.('filter state')==1,:)];
raw_TT_retimed = sortrows(raw_TT_retimed,'Time');
end
2 comentarios
Cris LaPierre
el 22 de Mzo. de 2023
Editada: Cris LaPierre
el 22 de Mzo. de 2023
How can you be sure that won't introduce the same data processing issue into your data?
Respuesta aceptada
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!