Development Environment | ![]() ![]() |
Saving Profile Reports
When you generate the profile report, use the option to save it. For example,
profile report basename
saves the profile report to the file basename
in the current directory. Later you can view the saved results using a Web browser.
Another way to save results is with the info = profile
function, which displays a structure containing the profiler results. Save this structure so that later you can generate and view the profile report using profreport
(info)
.
Example Using Structure of Profiler Results
The profiler results are stored in a structure that you can view or access. This example illustrates how you can view the results.
profile on -detail builtin -history [t,y] = ode23('lotka',[0 2],[20;20]);
stats = profile('info')
stats = FunctionTable: [41x1 struct] FunctionHistory: [2x826 double] ClockPrecision: 0.0100 Name: 'MATLAB'
MATLAB displays the FunctionTable
structure.
ans = 41x1 struct array with fields: FunctionName FileName Type NumCalls TotalTime TotalRecursiveTime Children Parents ExecutedLines
FunctionTable
structure, type, for example,stats.FunctionTable(2)
MATLAB returns the second element in the structure.
ans = FunctionName: 'horzcat' FileName: '' Type: 'Builtin-function' NumCalls: 43 TotalTime: 0.0100 TotalRecursiveTime: 0.0100 Children: [0x1 struct] Parents: [2x1 struct] ExecutedLines: [0x3 double]
save profstats
load profstats profreport(stats)
![]() | Profile Plot | Interfacing with Source Control Systems | ![]() |