Programming and Data Types    

An Example Using profile

This example demonstrates how to run profile:

  1. To start profile, type in the Command Window
  1. The -detail builtin option instructs profile to gather statistics for built-in functions, in addition to the default M-functions, M-subfunctions, and MEX-functions.

    The -history option instructs profile to track the exact sequence of entry and exit calls.

  1. Execute an M-file. This example runs the Lotka-Volterra predator-prey population model. For more information about this model, type lotkademo, which runs a demonstration.
  2. Generate the profile report and save the results to the file lotkaprof.
  1. This suspends profile, displays the profile report in your system's default Web browser, and saves the results. See Viewing profile Results for more information.

  1. Restart profile, without clearing the existing statistics.
  1. 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.

  1. Stop profile when you finish gathering statistics.

  The profile Function Viewing profile Results