Convert Minutes to Seconds
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hadi Hajieghrary
le 3 Août 2016
Réponse apportée : J. Webster
le 3 Août 2016
Please execute this line of code in Matlab R2015b:
>> [minutes(seconds(1)):minutes(1):minutes(seconds(200))]
Why it goes crazy and gives back a column vector of size 4777?
I need to create ticks for my plot; and I thought this had to work!
0 commentaires
Réponse acceptée
Thorsten
le 3 Août 2016
Modifié(e) : Thorsten
le 3 Août 2016
The help of minutes tells us
If X is a numeric array, then M is a duration array in units of minutes.
If X is a duration array, then M is a double array with each element equal to the number of minutes in the corresponding element of X.
so
minutes(seconds(1))
and
minutes(seconds(200)
give a double, while
minutes(1)
gives a duration. So you have
<double>:<duration>:<double>
which messes all up. To increment by 1 minute, use
minutes(seconds(1)):minutes(seconds(200))
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Dates and Time dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!