debugging a callback function

조회 수: 6 (최근 30일)
Alexander
Alexander 2013년 7월 18일
답변: Julian Dönges 2021년 10월 27일
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

채택된 답변

per isakson
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
Alexander
Alexander 2013년 7월 19일
Sorry, I should have been clearer. debug as normal was in reference to the manual method of adding break points in the scripts and waiting for the code to reach that point. dbstop is a fantastic tool. I am thankful for learning of it.
per isakson
per isakson 2013년 7월 19일
I'm glad the tip was helpful. See above, I added three links on debugging in Matlab.

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

추가 답변 (2개)

KAE
KAE 2017년 6월 8일
There is info on debugging a GUI here, both in the video and the comments.

Julian Dönges
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.

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by