How long until the weekend? - MATLAB Cody - MATLAB Central

Problem 2483. How long until the weekend?

  • Created by Jon
Difficulty:Rate

Write a function a that takes a date vector as an input and returns the number of hours until the weekend begins. The beginning of the weekend is defined as 5:00 PM on Friday. For example

input=[ 2014 08 04 08 00 00]
weekend(input) = 105
input=[ 2014 08 08 16 30 00]
weekend(input) = 0.5

str2num and other cheat functions are not allowed.

Solution Stats

45.86% Correct | 54.14% Incorrect
Last Solution submitted on Mar 26, 2025

Problem Comments

Solution Comments

Show comments
Who Deserves Your Praise? Discover the New Contribution Widget!
...
We are excited to announce another update to our Discussions area: the...

Problem Recent Solvers55

Suggested Problems

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page