Let's suppose you want to profile your MATLAB code, but you get the information over all the functions, MATLAB built-in and yours. This tutorial will show how to get information only about your functions, discarding the MATLAB built-in ones.
You will have to use the 'info' parameter of the profile function, and implement some logic around it. You will have to discard the built-in MATLAB functions by comparing their path names with matlabroot.
Here is an example of how you can do that, in your MATLAB console:
profile on yourMatlabFunction % Stop the profiler and save the stats info profile off statsInfo = profile('info'); % Sort the results by the total execution time [~,I] = sort([statsInfo.FunctionTable.TotalTime], 'descend'); for i = I % Get the files structure files = statsInfo.FunctionTable(i); % Discard the built-in Matlab functions if ~isempty(findstr(files.CompleteName, matlabroot)) continue; end % Print the execution time and the function name fprintf('%.06f sec\t', files.TotalTime); fprintf('%s\n', files.FunctionName); end