Réponse acceptée

per isakson
per isakson le 10 Oct 2017
Modifié(e) : per isakson le 10 Oct 2017

0 votes

datestr takes days as input. Thus, divide by 24.
>> val = 7.6;
>> datestr( val/24, 'HH:MM' )
ans =
07:36
I guessed that seven is hours, not minutes.

Plus de réponses (1)

Peter Perkins
Peter Perkins le 13 Oct 2017
Modifié(e) : Peter Perkins le 13 Oct 2017

2 votes

This depends on what you mean by "time". Likely, the most useful thing is a duration:
>> t = hours(7.6)
t =
duration
7.6 hr
>> t.Format = 'hh:mm:ss'
t =
duration
07:36:00

Catégories

En savoir plus sur Elementary Math dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by