hour to hour minute second conversion
Show older comments
I have an array represents hours, for example;
hour=[13.20,15.30,14.46,21];
Is there any matlab function to convert these hours to hour, minute, second? Example output;
hms=[13 12 0;15 18 0;14 27 36;21 0 0];
Accepted Answer
More Answers (1)
Teja Muppirala
on 30 Aug 2016
Edited: Teja Muppirala
on 30 Aug 2016
myTimes=[13.20,15.30,14.46,21];
HR = hours(myTimes');
[H,M,S] = hms(HR);
HMS = [H M S]
This gives
HMS =
13 12 0
15 18 0
14 27 36
21 0 0
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!