When using "Pause on Warning/Error," is there a way to avoid breaking into built-in functions?
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Joel Lynch
el 30 de Jun. de 2021
Comentada: Paul Kujawa
el 22 de Mayo de 2023
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.
0 comentarios
Respuesta aceptada
Jan
el 30 de Jun. de 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 comentarios
Stefan Schuberth
el 8 de Jun. de 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
el 22 de Mayo de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Whos en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!