missing data, time series
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Johannes Deelstra
am 3 Mai 2019
Kommentiert: Johannes Deelstra
am 15 Mai 2019
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
0 Kommentare
Akzeptierte Antwort
Peter Perkins
am 14 Mai 2019
All you need to do is call retime and tell it what you want the new time v ecgtor to be. Sometimes it's as simple as 'hourly', other times you'll need to create a time vector yourself. It sounds like you want every hour represented. 'hourly' does that.
Weitere Antworten (2)
Peter Perkins
am 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Tables finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!