missing data, time series
Afficher commentaires plus anciens
I am recording groundwater level at hourly intervalls using a data logger. I have data from 31 May 2017 09:00 hrs until 3 May 2019 03:00 hrs.
I noticed there are missing data as the total number of records should be 16843.
I generate a timeseries bb=[a1:ap:ae]; covering the indicated period where a1=datenum(2017,5,31,9,0,0), ap=datenum(0,0,0,1,0,0) and ae=datenum(2019,5,3,3,0,0) which gives the length of the time series being 16843
I read the logger data from excel into matlab with date in first column aa(:,1) while the second column (aa(:,2) contains the recorded logger data. I convert the Excel data to matlab data.
How can I now merge the data from aa with the dates in bb so that a second column (bb(:,2) has the reccorded logger data merged/combined with the correct date.
thanks before hand
Johannes
Réponse acceptée
Plus de réponses (2)
Peter Perkins
le 3 Mai 2019
Johannes, If I understand your question corre3ctly, you may want to consider using datetimes and a timetable. Not sure what form your data are in, but given a vector of values and a vector of timetstamps, both with a hole in them, this fills in the hole, in two different ways:
>> tt = timetable([1;2;4;5],'RowTimes',datetime(2019,5,3,[15 16 18 19],0,0))
tt =
4×1 timetable
Time Var1
____________________ ____
03-May-2019 15:00:00 1
03-May-2019 16:00:00 2
03-May-2019 18:00:00 4
03-May-2019 19:00:00 5
>> retime(tt,'hourly')
ans =
5×1 timetable
Time Var1
____________________ ____
03-May-2019 15:00:00 1
03-May-2019 16:00:00 2
03-May-2019 17:00:00 NaN
03-May-2019 18:00:00 4
03-May-2019 19:00:00 5
>> retime(tt,'hourly','spline')
ans =
5×1 timetable
Time Var1
____________________ ____
03-May-2019 15:00:00 1
03-May-2019 16:00:00 2
03-May-2019 17:00:00 3
03-May-2019 18:00:00 4
03-May-2019 19:00:00 5
Johannes Deelstra
le 6 Mai 2019
0 votes
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!