Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

mlintrpt - Run mlint for file or folder, reporting results in browser

GUI Alternatives

From the Current Folder browser, click the Actions button , and then select Reports > M-Lint Code Check Report. See also the automatic Checking M-File Code for Problems Using the M-Lint Code Analyzer in the Editor.

Syntax

mlintrpt
mlintrpt('filename','file')
mlintrpt('dirname','dir')
mlintrpt('filename','file','settings.txt')
mlintrpt('dirname','dir','settings.txt')

Description

mlintrpt scans all M-files in the current folder 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 folder. Here, dirname can be in the current folder 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.

Examples

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 Report for All Files in a Directory

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 folder.

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.

Run Report Using M-Lint Preference Settings

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 folder:

 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.

See Also

mlint

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS