Writing a Function Code

4 ビュー (過去 30 日間)
Lauren Kinchla
Lauren Kinchla 2019 年 11 月 14 日
コメント済み: Walter Roberson 2019 年 11 月 14 日
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 件のコメント
Walter Roberson
Walter Roberson 2019 年 11 月 14 日
Okay, go ahead.

サインインしてコメントする。

回答 (1 件)

Shubham Gupta
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
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 ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by