Potential Differences Reporting - MATLAB & Simulink (original) (raw)

Main Content

Generation of efficient C/C++ code from MATLAB® code sometimes results in behavior differences between the generated code and the MATLAB code. See Differences Between Generated Code and MATLAB Code.

When you run your program, run-time error checks can detect some of these differences. By default, run-time error checks are:

To help you identify and address differences before you deploy code, the code generator reports a subset of the differences as potential differences. A potential difference is a difference that occurs at run time only under certain conditions.

Addressing Potential Differences Messages

If the code generator detects a potential difference, it displays a message for the difference on the Potential Differences tab of the code generation report. See Code Generation Reports

The presence of a potential difference message does not necessarily mean that the difference will occur when you run the generated code. To determine whether the potential difference affects your application:

If your analysis or testing confirms the reported difference, consider modifying your code. Some potential differences messages provide a workaround. For additional information about some of the potential differences messages, see Potential Differences Messages. Even if you modify your code to prevent a difference from occurring at run time, the code generator might still report the potential difference.

The set of potential differences that the code generator detects is a subset of the differences that MEX functions report as errors. It is a best practice to test a MEX function over the full range of application data.

Disabling and Enabling Potential Differences Reporting

Potential differences reporting is enabled by default for standalone and MEX code generation whether you generate code by using the codegen command at the command line or by using the MATLAB Coder app.

To disable potential differences reporting:

See Also

Topics