Problem 137. wait for me
wait exactly x seconds please, need not be more than 2 seconds but must be accurate within say 50 milliseconds, your function must honestly output the amount of time it has actually waited and that will be tested against what it was supposed to do.
Solution Stats
Problem Comments
-
3 Comments
i think the best thing for this problem would be for you to do the timing in the test suite so that the player only needs to write the code to do the waiting. This will also prevent the user from just outputting the input argument.
You say that the function should return the time to within tol, yet you test for exact equality in the test suite? Why not test using the tol to conform to your description?
I succeeded in making this work in MATLAB, but I can't get it to work for the tests that occur here. From the solution map, it looks like others have the same frustration. Please follow the advice of bmtran and Fig, rewriting the problem so that the requirements are clear and there is not a problem with using tic in the function itself.
Solution Comments
Show commentsProblem Recent Solvers91
Suggested Problems
-
Return the largest number that is adjacent to a zero
5293 Solvers
-
Replace NaNs with the number that appears to its left in the row.
2956 Solvers
-
The Answer to Life, the Universe, and Everything
519 Solvers
-
MATCH THE STRINGS (2 CHAR) very easy
285 Solvers
-
Switch matrix to a column vector
345 Solvers
More from this Author100
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!