Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlintrpt

Run checkcode for file or folder

Syntax

Description

mlintrpt scans all MATLAB® code files in the current folder for Code Analyzer messages and reports the results in a MATLAB web browser.

example

mlintrpt(f) scans the specified file f.

example

mlintrpt(f, inputType) scans the specified file or folder f, as specified by inputType. Use 'file' to specify a file and 'dir' to specify a folder.

example

mlintrpt(___,settingsfile) overrides the default active settings file with the specified settings file. You can specify settingsfile with any of the input arguments in the previous syntaxes.

Examples

collapse all

Run mlintrpt on the example file lengthofline.m. MATLAB® displays a report of potential problems and improvements for lengthogline.

mlintrpt('lengthofline')

Run mlintrpt on all examples in the MATLAB® example folder matlabroot/matlab/help/techdoc/matlab_env/examples. MATLAB displays a report of potential problems and improvements for all MATLAB code files in this folder.

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

Suppress specific messages in a report by creating and specifying a settings file. For example, the file lengthofline.m includes several lines that use | instead of || as the OR operator. By default, mlintrpt flags these lines.

mlintrpt('lengthofline')

Create a settings file that suppresses the message flagging the use of | as the OR operator.

  1. On the Home tab, in the Environment section, click the Preferences button.

  2. Select Code Analyzer in the left pane.

  3. Under Default Settings, in the Aesthetics and Readability section, clear the message Use || instead of | as the OR operator in (scalar) conditional statements.

  4. Enter mysettings.txt as the file name and save it to your current folder.

  5. Press the Cancel button to exit out of the preference panel without changing the active settings.

Run mlintrpt on the example file using the custom settings file mysettings.txt. The message Use || instead of | as the OR operator in (scalar) conditional statements is suppressed and is no longer visible in the report.

mlintrpt('lengthofline','mysettings.txt')

Input Arguments

collapse all

File or folder name, specified as a character vector. The file name can include a partial path, but must be in a folder on the search path, or in the current folder.

Input type, specified as 'file' if the input is a file or 'dir' if the input is a folder.

Settings file name, specified as a character vector. If the file is not in the current folder, provide the full path to the file.

For information about creating a settings file, see Save and Reuse Code Analyzer Message Settings. If you specify an invalid file, the first message in the report is 0: Unable to open or read the configuration file 'mymlint.txt'--using default settings.

See Also

Introduced before R2006a

Was this topic helpful?