how to calculate time in matlab
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2016-5-7
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 个评论
更多回答(1 个)
the cyclist
2016-5-7
2 个评论
the cyclist
2016-5-8
According to the documentation, that functionality was introduced in version R2014b.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!