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 274535

Submitted on 6 Jul 2013 by Claudio Gelmi

Correct

24Size
Leading solution size is 7.
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
 
%%
timetorun();
t0 = tic;
pause(1)
t1 = timetorun();
t2 = toc(t0)-(t1+1);
assert(abs(t2)<5e-3)
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
2
Pass
 
%%
t0 = tic;
pause(1)
t1 = timetorun();
t2 = toc(t0)-(t1+1);
assert(abs(t2)<5e-3)
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
3
Pass
 
%%
t0 = tic;
pause(1)
t1 = timetorun();
t2 = toc(t0)-(t1+1);
assert(abs(t2)<5e-3)
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
4
Pass
 
%%
t0 = tic;
pause(1)
t1 = timetorun();
t2 = toc(t0)-(t1+1);
assert(abs(t2)<5e-3)
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
5
Pass
 
%%
t0 = tic;
pause(1)
t1 = timetorun();
t2 = toc(t0)-(t1+1);
assert(abs(t2)<5e-3)
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In timetorun at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Function /users/msssystem11/toc.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In toc at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]