Here is an attempt using a 'info'function parameter profile. I drop the matlab functions by comparing their full path name with matlabroot. Here is the code:
profile on
... % Put the code to profile here
% Stop the profiler and get infos
stats = profile('info');
% Sort results based on the total execution time
[~,I] = sort([stats.FunctionTable.TotalTime], 'descend');
for i = I
% Get file structure
F = stats.FunctionTable(i);
% Discard Matlab functions
if ~isempty(findstr(F.CompleteName, matlabroot))
continue;
end
% Display the total execution time and the function name
fprintf('%.06f sec\t', F.TotalTime);
fprintf('%s\n', F.FunctionName);
end
Although the profiler provides a view that looks much nicer, it does what you intended to do.
NB. , exist, core Matlab "". , repmat verLessThan , , .
,