duration to number(double)

조회 수: 748 (최근 30일)
Juan Camilo Gómez Cadavid
Juan Camilo Gómez Cadavid 2022년 2월 28일
댓글: Juan Camilo Gómez Cadavid 2022년 10월 17일
Any workaround to convert duration (seconds, hours, etc...) to a numeric value (double)

채택된 답변

Steven Lord
Steven Lord 2022년 2월 28일
Use seconds, hours, etc. depending on how you want the duration array to be converted to a number.
d = duration(1, 2, 3)
d = duration
01:02:03
s = seconds(d)
s = 3723
m = minutes(d)
m = 62.0500
h = hours(d)
h = 1.0342
  댓글 수: 5
Walter Roberson
Walter Roberson 2022년 10월 17일
When you apply minutes() or seconds() or days() or hours() to a double, then a duration object is created.
When you apply those functions to duration objects, double values are created.
For example
hours(days(7.2))
Juan Camilo Gómez Cadavid
Juan Camilo Gómez Cadavid 2022년 10월 17일
if the argument to any of these functions : seconds, minutes, hours, etc... its a duration class, the output will be a numeric datatype (double)
Instead, if the argument to any of these functions is numeric, value will be converted to duration

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by