Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 51081

Submitted on 25 Feb 2012 by Alan Chalker

Correct

37Size
Leading solution size is 14.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
tic
dog=@()pause(100/1000);
drowsy=wakeup(dog)
drowsy_correct = 1
toc
assert(drowsy==drowsy_correct)
assert(toc>1/10)
x =
    0.1390
drowsy =
     1
drowsy_correct =
     1
Elapsed time is 0.345926 seconds.
2
Pass
 
%%
tic
dog=@()pause(10/1000);
drowsy=wakeup(dog)
drowsy_correct = 0
toc
assert(drowsy==drowsy_correct)
assert(toc<1)
x =
    0.0233
drowsy =
     0
drowsy_correct =
     0
Elapsed time is 0.234257 seconds.