MATLAB Function Reference Previous page   Next Page
mlint

Check M-files for possible problems, and report results

Graphical Interface

In the Current Directory browser, select M-Lint Code Check Report from the list of Directory Reports presented on the toolbar.

Syntax

Description

mlint(filename) displays M-Lint information about filename. If filename is a cell array, information is displayed for each file. mlint(F1,F2,F3,...), where each input is a character array, displays information about each input filename. You cannot combine cell arrays and character arrays of filenames.

info=mlint(filename,'-struct') returns the M-Lint information in a structure array whose length is the number of suspicious constructs found. The structure has the following fields:

Field
Description
line
Vector of line numbers to which the message refers
column
Two-column array of column extents for each line
message
Message describing the suspect that M-Lint caught

If multiple filenames are input, or if a cell array is input, info will contain a cell array of structures.

msg=mlint(filename,'-string') returns the M-Lint information as a string to the variable msg. If multiple filenames are input, or if a cell array is input, msg will contain a string where each file's information is separated by 10 equal sign characters (=), a space, the filename, a space, and 10 equal sign characters.

If the -struct or -string argument is omitted and an output argument is specified, the default behavior is -struct. If the argument is omitted and there are no output arguments, the default behavior is to display the information to the command line.

[info,filepaths]=mlint(filename) will additionally return filepaths, the absolute paths to the filenames, in the same order as they were input.

info=mlint(filename,'-id') requests the message ID from M-Lint as well. When returned to a structure, the output will also have the id field, which is the ID associated with the message.

info=mlint(filename,'-fullpath') assumes that the input filenames are absolute paths, rather than requiring M-Lint to locate them.

To force M-Lint to ignore a line of code, add %#ok at the end of the line. This tag can be followed by comments. For example,

Examples

lengthofline.m is an example M-file with suspicious M-Lint constructs. It is found in $matlabroot/matlab/help/techdoc/matlab_env/examples. To display to the command line, run

To store to a struct with a message ID, run

See Also

mlintrpt


Previous page  mldivide \, mrdivide / mlintrpt Next page

© 1994-2005 The MathWorks, Inc.