Main Content

Potential Differences Reporting

Generation of efficient C/C++ code from MATLAB® code sometimes results in behavior differences between the generated code and the MATLAB code. When you run your program, run-time error checks can detect some of these differences. 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 report. To highlight the MATLAB code that corresponds to the message, click the message.

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:

  • Analyze the behavior of your MATLAB code for the range of data for your application.

  • Test a MEX function generated from your MATLAB code. Use the range of data that your application uses. If the difference occurs, the MEX function reports an error.

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

By default, potential differences reporting is enabled for code acceleration with fiaccel. To disable it, in a code acceleration configuration object, set ReportPotentialDifferences to false.

Related Topics