How to retime time series data every 15 minutes, or if it is not possible, to filter minutely data to 15-minutes data?
12 views (last 30 days)
Show older comments
Kasih Ditaningtyas Sari Pratiwi
on 4 Dec 2017
Commented: Kasih Ditaningtyas Sari Pratiwi
on 5 Dec 2017
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.
0 Comments
Accepted Answer
Akira Agata
on 5 Dec 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');
More Answers (0)
See Also
Categories
Find more on Data Preprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!