I have written down a function in 4 different ways and I want to time it .
Up-to now I have been doing this thing :
tic %//function 1 toc tic %//function 2 toc tic %//function 3 toc tic %//function 4 toc But now I want to compute the timing data for each function for (say 100 times) each and then compute the average time spent on each function. How can I do so?
Also I read somewhere that the time printed is the elapsed “wall clock” time – so it will be affected by whatever else my computer is doing whilst the MATLAB program was running.
So is there a better way of doing it ?? I have heard there is a MATLAB built in code-profiler with the command "profile on". Please can anyone suggest me the way in which I can use it?
I have also consulted the sites : Timing code in MATLAB and Profiler to find code bottlenecks.
Please suggest how to do this many times in a loop. Thanks in advance.
imfilterseparates the kernel if possible (you caneditit to see the code), and possiblyconv2does too, not sure. In any case, the execution time here seems dominated by the image load time, which you should exclude from the timing.