MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

MATLAB Code Analyzer Report


In this section...
“Running the Code Analyzer Report” on page 24-42
“Changing Code Based on Code Analyzer Messages” on page 24-44
“Other Ways to Access Code Analyzer Messages” on page 24-45

Running the Code Analyzer Report


The Code Analyzer Report displays potential errors and problems, as well as opportunities
for improvement in your code through messages. For example, a common message
indicates that a variable foo might be unused.

To run the Code Analyzer Report:

1 In the Current Folder browser, navigate to the folder that contains the files you want
to check.

To use the lengthofline.m example shown in this documentation, save the file to
the current folder, or to a folder for which you have write access. This example saves
the file to the current folder, C:\my_MATLAB_files.
copyfile(fullfile(matlabroot,'help','techdoc','matlab_env','examples','lengthofline.m'))

(^2) In the Current Folder browser, click , and then select Reports > Code Analyzer
Report.
The report displays in the MATLAB Web Browser, showing those files identified as
having potential problems or opportunities for improvement.
24 Coding and Productivity Tips

Free download pdf