I had time 21:09 and i want to generate previous 10 time events like 21:08 to 20:59. so how to implement?

2 views (last 30 days)
I used datenum but the difference between them is not same

Accepted Answer

Joseph Cheng
Joseph Cheng on 8 Feb 2016
Edited: Joseph Cheng on 8 Feb 2016
the units of datenum are in days so you need to subtract by the fraction of day.
datestr(datenum('21:09')-1/24/60,15) %will return 21:08
so
datestr(datenum('21:09')-[0:10]/24/60,15)
will generate the past 10 times

More Answers (0)

Community Treasure Hunt

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

Start Hunting!