Why do I obtain different results from the DATENUM and DATEVEC function in MATLAB 7.0 (R14) than I did in MATLAB 6.5 (R13SP1)?

조회 수: 2 (최근 30일)
When I execute the following command:
d = datenum('15:00:00')
In MATLAB 7.0 (R14), this returns:
d =
7.3195e+005
while in MATLAB 6.5.1 (R13SP1), it returned:
d =
0.625

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
This has been verified as a bug within the DATENUM function within MATLAB 7.0 (R14) in the way it handles specifying the string in "HH-MM-YY" syntax.
When specifying only the time, the DATENUM or DATEVEC functions in MATLAB 7.0 (R14) assume the day to be the first day of the current year. In MATLAB 6.5.1, they assume the day to be the 0 year "0/0/0000".
Currently, to emulate the behavior of MATLAB 6.5.1 (R13SP1), prepend this syntax specifying the 0 day, using:
d = datenum('0/0/0 15:00:00')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series Objects에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by