Info

This question is closed. Reopen it to edit or answer.

Put NaN values to incomplete records

1 view (last 30 days)
Poulomi Ganguli
Poulomi Ganguli on 12 Jun 2022
Closed: Poulomi Ganguli on 15 Jun 2022
Hello:
I have 3-hourly records for a daily time series records with lot of missing values for 30-yrs. Since 3-hourly records have 8 observations/day, I want to check for whether I have at least 4 records/day in the series. If I have less than that I want to discard that particular record and substitute NaN value. Could anyone please show how to achieve this. I am putting a reference series here.
  3 Comments
Jan
Jan on 12 Jun 2022
Edited: Jan on 12 Jun 2022
You have posted a text file. can we assume, that you are able to import the data already? Does exporting the result belong to the problem?
You want to set what exactly to NaN? What is "that particular record", if there are less then 4 records?
As far as I can see, in the given example you want to set all values of the last 4 columns to NaN. Then this is not a useful example. Maybe this is clearer:
1992 4 12 0 NaN NaN NaN NaN
1992 4 12 3 NaN NaN NaN NaN
1992 4 12 6 49.96 15.60 5.20 10.17 % Keep: >= 4 records
1992 4 12 9 32.06 21.00 3.70 11.85 % Keep: >= 4 records
1992 4 12 12 32.06 21.00 3.70 11.85 % Keep: >= 4 records
1992 4 12 15 32.06 21.00 3.70 11.85 % Keep: >= 4 records
1992 4 12 18 NaN NaN NaN NaN
1992 4 12 21 89.18 10.00 8.30 9.10 % Remove: >= 4, but
1992 4 13 0 89.18 10.00 8.30 9.10 % not on one day
1992 4 13 3 89.18 10.00 8.30 9.10
1992 4 13 6 89.18 10.00 8.30 9.10
1992 4 13 9 NaN NaN NaN NaN
1992 4 13 12 NaN NaN NaN NaN
1992 4 13 15 22.96 25.00 2.40 12.98 % Remove: < 4 records
1992 4 13 18 NaN NaN NaN NaN
1992 4 13 21 NaN NaN NaN NaN
Ganesh Gudipati
Ganesh Gudipati on 15 Jun 2022
Hi Poulomi,
As per my understanding, the first 4 columns represents year, month,date and time. The next 4 columns represents the observations you are recording for every 3 hours. When they are NaN it means data is not recorded at that particular point of time. So if data recorded <4 times in day you want to make all the recodings on that particular day to NaN.
Is that what you wanted?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!