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 Comments
Sign in to comment.