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

26 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Jan
Jan le 30 Juin 2021
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 commentaires
Stefan Schuberth
Stefan Schuberth le 8 Juin 2022
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 le 22 Mai 2023
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Variables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by