how to calculate time in matlab
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, how can I write a time in matlab and add minutes to it. For example: how to write a time into the matrix a=[7:00 7:15 7:30] and how to add 60 seconds to 7:00 , 85sec to 7:15 and 136sec to 7:30
Thanks
0 Commenti
Risposta accettata
Star Strider
il 7 Mag 2016
This will work in R2013b:
a=['7:00'; '7:15'; '7:30'];
% How to add 60 seconds to 7:00 , 85sec to 7:15 and 136sec to 7:30
add = [60; 85; 136];
sec_per_day = 24*60*60;
Result = datestr(datenum(a, 'HH:MM') + add/sec_per_day, 'HH:MM:SS')
Result =
07:01:00
07:16:25
07:32:16
3 Commenti
Più risposte (1)
the cyclist
il 7 Mag 2016
2 Commenti
the cyclist
il 8 Mag 2016
According to the documentation, that functionality was introduced in version R2014b.
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!