Writing a Function Code

1 vue (au cours des 30 derniers jours)
Lauren Kinchla
Lauren Kinchla le 14 Nov 2019
Commenté : Walter Roberson le 14 Nov 2019
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 commentaire
Walter Roberson
Walter Roberson le 14 Nov 2019
Okay, go ahead.

Connectez-vous pour commenter.

Réponses (1)

Shubham Gupta
Shubham Gupta le 14 Nov 2019
Modifié(e) : Shubham Gupta le 14 Nov 2019
Try:
function out = timeconv(t)
y = datestr(round(t/900)*900/(24*60*60),'HH:MM AM');
end
  1 commentaire
Walter Roberson
Walter Roberson le 14 Nov 2019
Please do not do people's homework for them. Guiding them to a solution is good though.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by