| MATLAB Function Reference | ![]() |
Run mlint for file or directory, reporting results in browser
From the Current Directory browser, select View > Directory Reports > M-Lint Code Check Report on the menu toolbar. See also the automatic M-Lint Code Analyzer in the Editor.
mlintrpt
mlintrpt('filename','file')
mlintrpt('dirname','dir')
mlintrpt('filename','file','settings.txt')
mlintrpt('dirname','dir','settings.txt')
mlintrpt scans all M-files in the current directory for M-Lint messages and reports the results in a MATLAB® Web browser.
mlintrpt('filename','file') scans the M-file filename for messages and reports results. You can omit 'file' in this form of the syntax because it is the default.
mlintrpt('dirname','dir') scans the specified directory. Here, dirname can be in the current directory or can be a full path.
mlintrpt('filename','file','settings.txt') applies the M-Lint settings to enable or suppress messages as indicated in the specified settings.txt file. For information about creating a settings.txt file, select File > Preferences > M-Lint, and click Help.
mlintrpt('dirname','dir','settings.txt') applies the M-Lint settings indicated in the specified settings.txt file.
Note If you specify a settings.txt file, you must specify the full path to the file. |
lengthofline.m is an example M-file with code that can be improved. It is found in matlabroot/matlab/help/techdoc/matlab_env/examples.
Run
mlintrpt(fullfile(matlabroot,'help','techdoc','matlab_env','examples'),'dir')
and MATLAB displays a report of potential problems and improvements for all M-files in the examples directory.

For details about these messages and how to improve the code, see Making Changes Based on M-Lint Messages in the MATLAB Desktop Tools and Development Environment documentation.
In File > Preferences > M-Lint, save preference settings to a file, for example, MLintNoSemis.txt. To apply those settings when you run mlintrpt, use the file option and supply the full path to the settings file name as shown in this example:
mlintrpt('lengthofline.m', 'file', ...
'C:\WINNT\Profiles\me\Application Data\MathWorks\MATLAB\R2007a\MLintNoSemis.txt')Alternatively, use fullfile if the settings file is stored in the preferences directory:
mlintrpt('lengthofline.m', 'file', fullfile(prefdir,'MLintNoSemis.txt'))Assuming that in that example MLintNoSemis.txt file, the setting for Terminate statement with semicolon to suppress output has been disabled, the results of mlintrpt for lengthofline do not show that message for line 49.
When mlintrpt cannot locate the settings file, the first message in the report is
0: Unable to open or read the configuration file 'MLintNoSemis.txt'--using default settings.
![]() | mlint | mlock | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |