checkcode
Check MATLAB code files for possible problems
Syntax
Description
Note
In R2022b: codeIssues
is recommended over
checkcode
because it features improved
interactivity and the ability to store identified issues.
checkcode(
displays
messages about filename
)filename
that report potential problems and
opportunities for code improvement. These messages are sometimes referred to as
Code Analyzer messages. The line number in the message is a hyperlink that you
can click to go directly to that line in the Editor. The exact text of the
checkcode
messages is subject to some change between
versions.
returns
the information as an info
= checkcode(___,'-struct')n
-by-1
structure
array, where n
is the number of messages found.
returns
the information as a character vector.msg
= checkcode(___,'-string')
If you omit the '-struct'
or '-string'
argument
and you specify an output argument, the default behavior is '-struct'
.
[___,
also returns filepaths
]
= checkcode(___)filepaths
,
the absolute paths to the file names. You can specify filepaths
with
either the '-struct'
or '-string'
options.
Examples
Input Arguments
Output Arguments
Tips
To force the Code Analyzer to ignore a line of code, use %#ok
at
the end of the line. You can add comments after the tag.
unsuppressed1 = 10 % This line will get caught suppressed2 = 20 %#ok This line will not get caught suppressed3 = 30 %#ok This line will not get caught
Extended Capabilities
Version History
Introduced in R2011b