Below is a small sample of code that uses Matlab's profiler to obtain the breakdown of time usage for a given routine (FluidsSolver2_DO3) and its subsequent calls.
%-------------------------
% initialize the profiler.
%-------------------------
profile on -history
%-----------------------------
% run the code to be profiled.
%-----------------------------
[P, u, v, rho, NodeP, Nodeu, Nodev] = FluidsSolver2_DO3 (app, SetupScript, PlotScript);
%-------------------------------------
% save an HTML summary of the results.
%-------------------------------------
profsave(profile('info'), 'directory_for_profile_results');
%-------------------------------------
% save a Matlab summary of the results.
%-------------------------------------
stats = profile('info');
save (fullfile('directory_for_profile_results','filename_for_matlab_summary'), 'stats');
An example of the HTML output can be found here.