How to format my data to a duration displaying mm:ss

13 vues (au cours des 30 derniers jours)
Alexi Cedric Roy
Alexi Cedric Roy le 7 Mai 2020
I've been looking at the documentation for some time now and i can't seem to figure it out:
I'm trying to enter my pace (in minutes per kilometer), and i've tried:
duration(a,'InputFormat','mm:ss');
where
a = {'5:45', '5:45', '4:57', '5:06'}
but it still shows me the pace in hh:mm:ss
ex:
ans =
1×4 duration array
00:05:45 00:05:45 00:04:57 00:05:06
How do I make it display as 5:45 (or 05:45)?

Réponse acceptée

Cris LaPierre
Cris LaPierre le 7 Mai 2020
a = {'5:45', '5:45', '4:57', '5:06'}
a = duration(a,'InputFormat','mm:ss');
a.Format = "mm:ss"
  1 commentaire
Alexi Cedric Roy
Alexi Cedric Roy le 8 Mai 2020
I was just missing that last line, it works perfectly, thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by