Why the function "timeit" doesn't work correctly
13 views (last 30 days)
I have a problem in function timeit (also tic toc) in matlab R2016a , it dsesn't calculate the correct time , for exemple: the result supposed to be: 4,.... seconds but it gives always 0,3....(the same code give a correct answer but in Matlab 2014)
Jan on 7 Aug 2022
timeit and tic/toc measure the runtime. If they determine a runtime of 4 seconds in Matlab R2014 and just 0.3 seconds in Matlab R2016a, this means, that Matlab works faster for the concerned results.
Remember, that the new graphics engine HG2 was introduced in R2014b. Maybe tic/toc measures the time before a complicated figure is rendered. So insert a drawnow in your code.
As said alread: As long as you do not mention any details about the code, it is impossible to understand, why you assume a problem. Post some code, which reproduces the problem and a more explicit explanation is possible.