What is the equivalent datetime() call to the clock() function?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
William Goolsby
le 5 Avr 2024
Modifié(e) : Stephen23
le 16 Avr 2024
I have some code from 2010 that uses clock(), which is not recommended in R2022b. clock() returns an array of double. How can I get this result by using datetime()? I don't see any examples that do this. For example,
c = clock
c is [2024 4 5 10 47 21.9]
0 commentaires
Réponse acceptée
Stephen23
le 15 Avr 2024
Modifié(e) : Stephen23
le 16 Avr 2024
Note that DATETIME is an object with properties, so (depending on your requirements) accessing its properties is a simple option that does not require calling any other functions:
dt = datetime('now')
dt.Year
dt.Month
dt.Day
dt.Hour
dt.Minute
dt.Second
Plus de réponses (0)
Voir également
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!