Writing a Function Code
3 次查看(过去 30 天)
显示 更早的评论
I need to write a function that receives a float as input which represents a timestamp in seconds since midnight. It need to return the time in HH:MM AM/PM format but rounded to the nearest 15 minute peroid
回答(1 个)
Shubham Gupta
2019-11-14
编辑:Shubham Gupta
2019-11-14
Try:
function out = timeconv(t)
y = datestr(round(t/900)*900/(24*60*60),'HH:MM AM');
end
1 个评论
Walter Roberson
2019-11-14
Please do not do people's homework for them. Guiding them to a solution is good though.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!