code timing - Strange results from tic / toc in MATLAB -


i'm checking running time of function using tic/toc. write following in command window (and execute simultaneously):

tic res = checkfunc('case2736sp',1:3000); toc elapsed time 0.080491 seconds. 

where checkfunc returns 2736x2500 full matrix.

what puzzles me have wait 20 seconds output saying run time 80 ms.

does have clue why is?

it's possible tic/toc's internal counter getting reset somehow during execution. try this:

t = tic res = checkfunc('case2736sp',1:3000); toc(t) 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -