Programming and Data Types    

Running the Profiler

This is a quick summary. Details follow.

To profile an M-file or a line of code, follow these steps:

  1. In the Run this code field in the Profiler, enter the statement you want to run.

  1. You can run this example

    as the code is provided with MATLAB demos. It runs the Lotka-Volterra predator-prey population model. For more information about this model, type lotkademo, which runs demonstration.

    If you are running a statement you previously profiled in the current MATLAB session, select the statement from the list box and skip to step 3.

  1. Click Start Profiling (or press Enter after entering the statement).

  1. While the Profiler is running, the Profile time indicator (at the top right of the Profiler window) is green and the number of seconds it reports increases.

    When the profiling is finished, the Profile time indicator becomes black and shows the length of time the Profiler ran.

    This is not the actual time that your statements took to run, but is the time elapsed from when you clicked Start Profiling until you clicked Stop Profiling. If the time reported is much different from what you expected (for example hundreds of seconds for a simple statement), you might have had profiling on longer than you realized.

  1. When profiling is complete, the Profile Summary report appears in the Profiler window.

Profiling a Graphical User Interface.   You can run the Profiler for a graphical user interface, such as the Filter Design and Analysis tool included with the Signal Processing Toolbox. You can also run the Profiler for an interface you created, such as one built using GUIDE.

To profile a graphical user interface, do the following.

  1. In the Profiler, click Start Profiling.
  2. Start the graphical user interface. If you do not want to include its startup process in the profile, do not click Start Profiling until after you have started the graphical interface.
  3. Use the graphical interface. When you are finished, click Stop Profiling in the Profiler.
  1. The Profile Summary report appears in the Profiler.

Profiling Statements from the Command Window.   To profile more than one statement, do the following:

  1. In the Profiler, clear the Run this code field and click the Start Profiling button.
  2. In the Command Window, enter and run the statements you want to profile.
  1. The status bar in the desktop reports Profiler on when MATLAB is not busy and the Profiler is running.

  1. After running all the statements, click Stop Profiling in the Profiler.
  1. The Profile Summary report appears in the Profiler.


  The Profiler Profile Summary Report