Sequence of date with no leap year

4 ビュー (過去 30 日間)
Hydro
Hydro 2017 年 8 月 17 日
コメント済み: Peter Perkins 2017 年 8 月 23 日
Hello all, I am analyzing climate data from a model that does not consider leap day. Is there a way to generate sequence of dates without considering the leap day? i generate the dates that i am interested, however, i do not know how to remove the leap day out of it. Any help would be appreciated.
startDate = datetime(1986,01,01);
endDate = datetime(2005,12,31);
Time=(startDate:endDate)';

採用された回答

the cyclist
the cyclist 2017 年 8 月 17 日
編集済み: the cyclist 2017 年 8 月 17 日
Add this line after you create your Time variable:
Time(month(Time)==2 & day(Time)==29) = []
  2 件のコメント
Hydro
Hydro 2017 年 8 月 17 日
It worked. Thank you
Peter Perkins
Peter Perkins 2017 年 8 月 23 日
Just remember, if you do any kind of arithmetic on that sequence, it will behave like a sequence of days that has had Feb 29ths removed, not as if you are using some special calendar. The number of days between 1-Feb-2016 and 1-Mar-2016 as computed by caldiff, for example, will still be 29.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by