Find missing dates in dataset and make observations NaN?

3 ビュー (過去 30 日間)
Daphne PARLIARI
Daphne PARLIARI 2021 年 1 月 8 日
コメント済み: Daphne PARLIARI 2021 年 1 月 11 日
Hello and happy new year!
I have a dataset (see attached) with daily values of temperature from 2013 to 2016 . Column Daily_DATE contains the dates fow which I actually had a value for temperature, NaT indicates days with no observation. Column Time_Seq_Full contains all dates from 01-Jan-2013 to 31-Dec-2016.
Is there any way I can display the dates from Time_Seq_Full that doesn't correspond to a date in Daily_DATE (AKA find the missing dates), and in the same time make the respective values of Daily_T = NaN?
Thank you in advance!
PS. I am on 2019a.

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 1 月 8 日
I would think you could use logical indexing to find the rows of Daily_DATE that are equal to NaT. You can then use that index to set the corresponding rows of Daily_T to NaN, and extract the corresponding dates from the rows of Time_Seq_Full.
  1 件のコメント
Daphne PARLIARI
Daphne PARLIARI 2021 年 1 月 11 日
Thanks for the help!
In case anyone finds it helpful, here is the code that solved my problem:
m=1;
for i = 1: length(Daily_Data.Daily_DATE)
if Daily_Data.Daily_DATE(i)~=Daily_Data.Time_Seq_Full(i)
Daily_Data.Daily_T(i) = NaN; Daily_Data.Daily_Tappmax(i) = NaN;
NoData_Dates(m, :) = Daily_Data.Time_Seq_Full(i);
m=m+1;
end
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHolidays / Seasons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by