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

26 ビュー (過去 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 Center および File ExchangeVariables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by