Easy question converting numbers to hours
1 次查看(过去 30 天)
显示 更早的评论
Hi all, I know this should be easy, but how would you convert whole numbers into HH:MM format? Like say 1156 into 11:56 ? Thank you
0 个评论
采纳的回答
Azzi Abdelmalek
2016-9-1
编辑:Azzi Abdelmalek
2016-9-1
datestr(datenum(sprintf('%04d',1156),'HHMM') ,'HH:MM')
Or
a=sprintf('%04d',1156)
a=sprintf('%s:%s',a(1:2),a(3:4))
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!