Skip to Main Content Skip to Search
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Inside the MATLAB Desktop

June 23rd, 2008

Profiling using run configurations

We talk a lot about work flows here on the Inside the MATLAB Desktop blog, as well as ways you can streamline your interactions with MATLAB. For the Editor-centric folks in the audience, here’s a great way to integrate Profiling into your workflow using run configurations.

Profiling run configurations will let you tweak the performance of your code more iteratively. You’ll be able to work from the Editor, press the run button, inspect the performance, and then go right back to your code to tweak it.

To setup a profiling run configuration, start by opening the file you’d like to improve the performance of in the MATLAB Editor. Then, open the Configuration Editor by pressing the drop-down arrow on the run button , and select Edit Run Configurations for [your file]. In the MATLAB Expression area, put the following commands, where your_function is the function to profile:

% start profiling.
profile on;
% call your function here.
your_function
% stop profiling.
profile off;
% show the profile viewer.
profile viewer;

Which should look something like this:

Close the Configuration Editor when your done.

Back in the Editor, you can click the run button (or press F5) and your code will be profiled. The Profiler will popup after running your function, so you’ll be able to immediately inspect the results, teak your code and re-run your function. To prevent the Profiler from obscuring the Editor, try docking it in the Desktop. This is a great technique for iterativley improving your code’s performance.

Check out the MATLAB documentation for more information on the profile function.

Leave a Reply


Inside the MATLAB Desktop is written by the MATLAB Interface teams.

Team picture
  • Etienne: Hello, Is it possible to change the background color of a particular cell?
  • Ken: No problem Mark…glad to help. Enjoy your font!
  • Mark Andrews: Ken, thanks for replying @3 and giving such clear instructions on how to get this to work.
  • Steve Eddins: Hi Ken, Every year or so I try to find a programming font that would really make me happy. A couple of...
  • Ken: @Jiro: Andale Mono looks nice! I especially like the rendering of the letter “g”.
  • Ken: Hi Mark, The issue your referring to (see the bug report here) was fixed in version 7.5 (R2007b). The problem...
  • Jiro: Ken, That’s a nice font. I use “Andale Mono” which has a similar look. I also like the clear...
  • Queffurust: This is my “cleanup” ; shortcut clc % clear Command Window close all hidden % deletes all...
  • Mark Andrews: Ken, should this work with version 7.0 (R14) on Windows? My favorite font is Consolas, but MATLAB seems...
  • Mark Feldman: Like Bryan (#38) and Kim (#40), I strongly request that you add native vi key bindings to the MATLAB...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.

Related Topics