Introducing new rows (or columns) into an existing matrix with interpolated values to fill technically non-existent gaps.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a dataset from a GPS unit that occasionally skips a second or two. I'd like to fill in the missing time gaps with the average of the previous and subsequent rows (well actually, that wouldn't work if there was a two second gap). Note: Each time I run this, the set of GPS data will be different and may or may not have these gaps in time.
For example, here is a snippet of what the matrix of interest looks like. The first column is a reference that mathes up with other data; After that it is YY MM DD HH MM SS. As you can see, the 49th second is missing.
GPS_time = [4791 20 11 8 23 32 47; 4792 20 11 8 23 32 48; 4794 20 11 8 23 32 50; 4795 20 11 8 23 32 51]
If you don't know but would like to help, I have two thoughts on how to approach this:
1. Create a complete reference from the first and last values of the reference column with no gaps to merge with the GPS_time matrix and using fillmissing to replace the missing values. I am trying to do this now, but am having trouble.
2. Give up and use the first and last rows of data from GPS_time to re-build the matrix from scratch. This doesn't sound fun because of the way time wraps around on itself before adding to the previous columns value.
I am using R2017a, btw.
0 Kommentare
Antworten (1)
Walter Roberson
am 4 Dez. 2020
Create a timetable() object and use retime() https://www.mathworks.com/help/releases/R2017a/matlab/ref/retime.html
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!