When using "Pause on Warning/Error," is there a way to avoid breaking into built-in functions?

조회 수: 23 (최근 30일)
For example, a bad set of data when calling "fit" breaks into a function called "curvefit.attention/Warning/throw":
Warning: Equation is badly conditioned. Remove repeated
data points or try centering and scaling.
> In curvefit.attention/Warning/throw (line 30)
In fit>iLinearFit (line 680)
In fit>iFit (line 391)
In fit (line 116)
In my_fit_function (line XX)
The message is useful, but having my workspace scope in "curvefit.attention/Warning/throw" is useless. It would be helpful to return the workspace scope to "my_fit_function" to see what data actually threw the warning/error. How can this be done? ~Thanks!
EDIT: I partly answered my own question. "Function Call Stack" in the IDE allows selecting the workspace scope. Still, it would be helpful to set the default behavior to break within user-defined scripts rather than in built-in functions, if possible.

채택된 답변

Jan
Jan 2021년 6월 30일
Matlab cannot guess in which level you want to display the call stack. So either select it manually, or use try/catch/rethrow for a user-controlled error handling. Then Matlab stops in the level, you have inserted rethrow in.
  댓글 수: 2
Stefan Schuberth
Stefan Schuberth 2022년 6월 8일
Manual error handling is time consuming and the source code has to be modified. As Joel Lynch asked it should be possible to stop the call stack at the last user defined function throwing this error! This would be a much more powerful feature. Stopping in build-in functions is useless.
Paul Kujawa
Paul Kujawa 2023년 5월 22일
I agree wholeheartedly with Stefan. Not once have I ever paused execution with the intent of debugging at the level of whatever built-in function that is running at that time. At the very least don't dump me into the interrupt script of said function. Of course there's no reason why that ability shouldn't be retained as an option for those who do wish to debug built-in functions for whatever reason.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by