how to convert datetime array to double

조회 수: 5 (최근 30일)
awhan 99
awhan 99 2019년 5월 11일
댓글: Robert Garnett 2020년 2월 17일
How can I convert the datetime array to Double? for example,
>> dt = datetime( '08:07:53', 'InputFormat', 'HH:mm:ss' );
>> dt.Format = 'HH:mm:ss';
>> T1 = (dt + hours(1:5)+seconds(1:5))'
Thanks!!
  댓글 수: 2
Peter Perkins
Peter Perkins 2019년 6월 4일
You probably don't need to convert to double. What are you trying to do?
You almost certainly do not want to convert '08:07:53' to a datetime, unless you mean "08:07:53 today", where the definition of "today" changes every day.
Robert Garnett
Robert Garnett 2020년 2월 17일
If you want to use gridded interpolation of a variable versus a datetime array you have to convert the date to double viz:
Error using griddedInterpolant
The input points must be a single or double array.

댓글을 달려면 로그인하십시오.

답변 (1개)

madhan ravi
madhan ravi 2019년 5월 11일

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by