Find and fill in missing records/data/lines/rows from array
2 views (last 30 days)
Hi there, I have 5 year long datasets, each should be 8760 rows long(the no. hours in a non-leap year), but the datasets are not consistent, they are 8752, 8731, 8757, 8760, 8759 long. Obviously, at some hours the data was not recorded at all, and are completely missing at random points in my file.
The Colums Headers are seen below. D1,MS1 etc. representing the 1st row of data values
ob_end_time Direction MeanSpeed MaxGustDirection MaxGustSpeed MaxGustTime
01/01/2019 00:00 D1 MS1 MGD1 MGS1
01/01/2019 01:00 D2 MS2 MGD2 MGS2
MISSING MISSING MISSING MISSING MISSING
31/12/2019 22:00 D8759 MS8759 MGD8759 MGS8759
31/12/2019 23:00 D8760 MS8760 MGD8760 MG8760
How do I go about finding where the missing data records are and then filling the missing rows with the correct time, so each year has 8760 values? e.g. if 03/03/2019 was non-existant, to create a new row there, fill in the missing date, and then the other missing parameters?
How would I also go about filling in the missing values for the other columns(I assume taking an average of the values above and below would work?
I am somewhat new to matlab and this is all I need help with. I appreciate any help you can give, thanks.