Writing a Function Code
1 回表示 (過去 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 で Get Started with MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!