
7 Tuning and Managing M-Files
1 To start profile, type in the Command Window
profile on
2 Execute an M-file. T his example runs the Lotka-Volterra predator-prey
population model. For more inf ormation ab out this mode l, type
lotkademo,
which runs a dem onstration.
[t,y] = ode23('lotka',[0 2],[20;20]);
3 Generate the profile report and display it in the Profiler window. T his
suspends
profile.
profile viewer
4 Restart profile, without clearing the existing statistics.
profile resume
The profile function is now ready to continue gathering statistics for any
more M-files you run. It will add these new statistics to those generated
in the previous steps.
5 Stop profile w h en you finish gathering statistics.
profile off
6 To view the profile data, call profile specifying the 'info' argument. The
profile function returns d ata in a structure.
p = profile('info')
p=
FunctionTable: [10x1 struct]
FunctionHistory: [2x0 double]
ClockPrecision: 3.3333e-010
ClockSpeed: 3.0000e+009
Name: 'MATLAB'
The FunctionTable indicates that statistics were gathered for 10 functions.
7-44
Komentáře k této Příručce