debugging a callback function
10 次查看(过去 30 天)
显示 更早的评论
Hi, I am trying to produce a code that plots certain information in a gui figure so that the user can make a decision, based on the plot, which function to execute next. The functions are executed by buttons on the gui figure. As the functions are triggered by callbacks if I try to debug as normal I am not able to access the function. How can I get into the function to find my error?
Thanks
0 个评论
采纳的回答
per isakson
2013-7-18
编辑:per isakson
2013-7-19
"[...] debug as normal [...]"? Could you provide an example? I would either set
>> dbstop if error
or set a breakpoint in the callback function before I fire the callback.
Here are some links on debugging in Matlab
2 个评论
per isakson
2013-7-19
I'm glad the tip was helpful. See above, I added three links on debugging in Matlab.
更多回答(2 个)
Julian Dönges
2021-10-27
Breakpoints in callbacks work only if you also set a breakpoint in the caller function/script. So, you could add a line of pause(0.1); to the caller function/script and set a breakpoint there. When the caller is stopped at that breakpoint, the breakpoint inside the callback will work as well.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!