Skip to Main Content Skip to Search
Product Documentation

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

Alternatives

From the Current Folder browser, click the Actions button , and then select Reports > Code Analyzer. See also Automatically Check Code in the Editor — Code Analyzer.

Syntax

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

Description

mlintrpt scans all files with an .m file extension in the current folder for Code Analyzer messages and reports the results in a MATLAB Web browser.

mlintrpt('filename','file') scans filename for Code Analyzer 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 Code Analyzer preference 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 > Code Analyzer, and then click Help.

mlintrpt('dirname','dir','settings.txt') applies the settings indicated in the specified settings.txt file.

Examples

lengthofline.m is an example 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 Folder

Run

mlintrpt(fullfile(matlabroot,'help','techdoc','matlab_env','examples'),'dir')

and MATLAB displays a report of potential problems and improvements for all files with an .m file extension in the examples folder.

For details about these messages and how to improve the code, see Changing Code Based on Code Analyzer Messages in the MATLAB Desktop Tools and Development Environment documentation.

Run Report Using Code Analyzer Preference Settings

In File > Preferences > Code Analyzer, save preference settings to a file, for example, NoSemis.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\NoSemis.txt')

Alternatively, use fullfile if the settings file is stored in the preferences folder:

 mlintrpt('lengthofline.m', 'file', fullfile(prefdir,'NoSemis.txt'))

Assuming that in that example NoSemis.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 'NoSemis.txt'--using default settings.

See Also

checkcode

  


» Learn more
» Download free kit
» Get trial software

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