Effacer les filtres
Effacer les filtres

How to retime time series data every 15 minutes, or if it is not possible, to filter minutely data to 15-minutes data?

27 vues (au cours des 30 derniers jours)
Hi! I have a question about how to retime time series data every 15 minutes. I have a time series data and I intend to retime it every 15 minutes. I use retime function, however it only provides retime in minutely for minute range. Is there any other way to retime time series data every 15 minutes?
Otherwise, I want to filter minutely data (from original data that I have retimed into minutely range) in every 15 minutes range. Is it possible to do that? I attach my original data, and here is the code I use for retime every minute:
%%Rainfall analysis
% for every minute
minutelyrainfall=table2timetable(rainanalysis);
minutelyrainfall=retime(minutelyrainfall,'minutely','linear');
minutelyrainfall=timetable2table(minutelyrainfall);
I would really appreciate for your help. Thank you very much in advance.

Réponse acceptée

Akira Agata
Akira Agata le 5 Déc 2017
To retime your data in every 15 minutes, first you should convert your data into 'timetable,' next create datetime vector (= resampling timing) and finally apply retime function. Here is an example.
load('rainanalysisdata.mat');
% Convert to timetable
rainanalysis.DatumUhrzeit = datetime(rainanalysis.DatumUhrzeit);
rainanalysis = table2timetable(rainanalysis);
% Create time vector (15 min duration)
t = rainanalysis.DatumUhrzeit(1);
startTime = datetime(t.Year,t.Month,t.Day,t.Hour,0,0);
time = (startTime:minutes(15):rainanalysis.DatumUhrzeit(end))';
% Resampling
rainanalysis2 = retime(rainanalysis,time,'linear');
  1 commentaire
Kasih Ditaningtyas Sari Pratiwi
Thank you so much, Akira Agata. I did not know that we can define start time and end time that way. Thanks, you're a life saver!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by