필터 지우기
필터 지우기

MATLAB gives different results when compiled vs interactive

조회 수: 7 (최근 30일)
Here at the Kepler SOC, we have observed numerous examples of situations in which our MATLAB applications produce different results depending on whether the application is run interactively or compiled via the MATLAB compiler. This can be the case when the MATLAB code in both instances is identical and when the two tests are run on the same workstation (64 bit Linux and R2010b, FYI). Can anyone explain why this should happen, and what we can do to minimize the circumstances under which it does happen? Thanks in advance.

채택된 답변

Andreas Goser
Andreas Goser 2012년 1월 14일
I am collecting reasons for those effects and like to link it to this post, although it is certainly a different issue.
While I agree with the other answers so far, I still understand the user's perspective and question how to minimize this occurence. First, I like to distinguish between very small differnces, that are not changes a conclusion from a computation and differences, that really lead to complete results.
In the practical life, I would debug such applications in a way to identifies the main contributor for the differences in the code. Often, this is just a single line in a loop where small numerical differences add up. In most cases, there are better algorithms that are "numerically safe".

추가 답변 (2개)

Image Analyst
Image Analyst 2012년 1월 14일
There could be a variety of reasons, for example data files not being where you thought they were because you didn't use the complete path and then creating default data values instead, or any number of other reasons. Even when run on the same workstation, the compiled app and the m-file do not run in the same folder, even though you might think they do (it's a long story...), so that might cause some differences.

Walter Roberson
Walter Roberson 2012년 1월 14일
The two situations are not defined to have the same floating point rounding behavior.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by