MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
Code analysis cannot determine whether x is a structure or a handle object. To minimize
the number of incorrect messages, code analysis returns no message for the previous
code, even though it might contain a subtle and serious bug.

Distinguish Built-In Functions from Overloaded Functions

If some built-in functions are overloaded in a class or on the path, Code Analyzer
messages might apply to the built-in function, but not to the overloaded function you are
calling. In this case, suppress the message on the line where it appears or suppress it for
the entire file.

For information on suppressing messages, see “Adjust Code Analyzer Message Indicators
and Messages” on page 24-11.

Determine the Size or Shape of Variables

Code analysis has a limited ability to determine the type of variables and the shape of
matrices. Code analysis might produce messages that are appropriate for the most
common case, such as for vectors. However, these messages might be inappropriate for
less common cases, such as for matrices.

Analyze Class Definitions with Superclasses

Code Analyzer has limited capabilities to check class definitions with superclasses. For
example, Code Analyzer cannot always determine if the class is a handle class, but it can
sometimes validate custom attributes used in a class if the attributes are inherited from a
superclass. When analyzing class definitions, Code Analyzer tries to use information from
the superclasses but often cannot get enough information to make a certain
determination.

Analyze Class Methods

Most class methods must contain at least one argument that is an object of the same class
as the method. But it does not always have to be the first argument. When it is, code
analysis can determine that an argument is an object of the class you are defining, and it
can do various checks. For example, it can check that the property and method names
exist and are spelled correctly. However, when code analysis cannot determine that an
object is an argument of the class you are defining, then it cannot provide these checks.

Enable MATLAB Compiler Deployment Messages


You can switch between showing or hiding Compiler deployment messages when you
work on a file by changing the Code Analyzer preference for this message category. Your

24 Coding and Productivity Tips

Free download pdf