MATLAB Speed: Using the M-Lint Utility

Posted on December 4, 2007
Filed Under matlab |

A great deal of my work is done in MATLAB these days, and I come across many neat little features of the language and the IDE that are hidden among the menus. Sure, you’d know all about them if you read the manual, but who has time for that?

Here is a little trick to help you optimize your code. MATLAB comes with a utility called M-Lint that analyzes your code and tries to help you make it run faster. To enable it, in the main IDE, select the Desktop menu, -> Current Directory, to make the directory bar appear. This allows you  to browse your projects and files easily:

Matlab IDE

Once you’ve enabled the directory view, scroll to the directory containing your project (your m-files). Next, select the M-Lint report generator from a tab that’s practically hidden in the directory view (fortunately for you I’m pointing it out):

M-Lint Report Generator

Try finding that on your own! Once you select it, it automatically processes all of the m-files in the current directory and generates a report on each one:

M-Lint report

The report is quite detailed, specifying line numbers where your code might be improved and suggesting how (and why!) it should be altered. This can even teach you quite a few things you’re not even aware of!

Comments

Leave a Reply