create timeseries from first january to 31. December

4 ビュー (過去 30 日間)
Ha Sen
Ha Sen 2018 年 8 月 14 日
回答済み: Steven Lord 2018 年 8 月 15 日
Hi ,
I am trying to create a vector of timeseries with only months and days. No Year! I tried a few funktions but it requires to have a year. Somehow it is difficult to not include the year.
I appreciate any help.
  1 件のコメント
dpb
dpb 2018 年 8 月 14 日
That's so at present, yes. Closest so far is duration class that can be such, but even it requires a year to handle calendar durations owig to leap years messing things up.
You can set the display format to not show years and pretend they're not there visually but unfortunately all coding has to include them to get comparisons, etc., to work.

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

回答 (1 件)

Steven Lord
Steven Lord 2018 年 8 月 15 日
I don't believe that's possible. How many days long is the vector from January 1st to December 31st? That's a simple question, right?
The answer to that simple question depends on whether the year containing those two dates is a leap year, a non-leap year, 1712 in Sweden, or perhaps 1753 in Sweden. [I'm not really sure off the top of my head how datetime handles those last two scenarios.]

カテゴリ

Help Center および File ExchangeCalendar についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by