Check MATLAB code files for possible problems
checkcode(filename)
checkcode(filename1,...,filenameN)
checkcode(___,option1,...,optionN)
info = checkcode(___,'-struct')
msg = checkcode(___,'-string')
[___, filepaths]
= checkcode(___)
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.
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