MATLAB Answers


debugging a callback function

Asked by Alexander
on 18 Jul 2013

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?



1 Answer

Answer by per isakson
on 18 Jul 2013
Edited by per isakson
on 19 Jul 2013
 Accepted answer

"[...] 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


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.

I'm glad the tip was helpful. See above, I added three links on debugging in Matlab.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!