Installation guide
7 Tuning and Managing M-Files
M-Lint Code Check Report
In this section...
“Running the M-Lint Code Check Directory Report” on page 7-16
“Making Changes Based on M -Lint M e ssages” on page 7-18
“Other Ways to A ccess M-Lint” on page 7-26
RunningtheM-LintCodeCheckDirectoryReport
TheM-LintCodeCheckReportdisplays potential errors and problems, as
well as opportunities for improvement in y our code. The term “lint” is the
name given to similar tools used with other programming languages such as
C. In MATLAB, M-Lint produces a message for e ach line of an M-file that it
determines might be improved. For example, a common M-Lint message is
that a v ariable
foo in line 12 is defined but never used in the M-file.
To run the M-Lint code check directory report, follow these steps:
1 In the Current Directory browser, navigate to the directory that contains
theM-filesyouwanttocheckwithM-Lint. To use the example shown in
this documentation,
lengthofline.m, you can change the current directory
by running
cd(fullfi
le(matlabroot,'help','techdoc','matlab_env','examples'))
2 Ifyouplantomodifytheexample,savethefiletoadirectoryforwhichyou
have write access, and then make that directory the current MATLAB
directory. In this example, the file is saved to
I:\MATLABFiles\mymfiles.
3 In the Current Directory browser toolbar, select the M-Lint Code Check
Report
from the Directory Reports listing—for de tails, see “Accessing and
Using Directory R eports” on page 7-2.
The M-Lint Code Check Re port displays in the MATLAB Web Bro w ser,
showing those M -files that M-Lint identified as having potential problems
or opportunities for improvement.
7-16