필터 지우기
필터 지우기

How do I write a function that inputs seconds and outputs the number of days, hours, and mins?

조회 수: 2 (최근 30일)
I'm confused in writing a function that can take seconds as an input and provides an output in the number of days, hours, minutes, and seconds, if applicable.

답변 (1개)

Shanmukha Voggu
Shanmukha Voggu 2021년 10월 1일
Hi,
Using Format property of the duration solves the issue
tim=seconds(94255)
tim = duration
94255 sec
tim.Format='dd:hh:mm:ss'
tim = duration
01:02:10:55
Refer this for more information about seconds function
Hope this helps!

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by