When does DBSTOP not apply to callbacks?

I find (in R2013b, R2014b) that when I make the debugger active with
>> dbstop if error
that errors in certain callback functions fail to trigger debug mode. In particular, when I run the test() mfunction below and place a datatip in the figure it generates, the datatip text shows "Error in custom datatip string function".
function test
X=rand(100);
imagesc(X);
hdt = datacursormode(gcf);
set(hdt,'UpdateFcn',@tipcallback);
figure(gcf);
datacursormode on
function output_txt = tipcallback(obj,event_obj)
output_txt=whatever; %<--Debug mode should trigger here
I do expect an error to occur at the line indicated in tipcallback() because a non-existent variable "whatever" is referenced there. However, because I have used DBSTOP, I expect to get the K>> prompt at the indicated line. Yet, debug mode is never triggered. Is it due to some special behavior of callback functions? If so, why do I see this problem only in the datacursormode's 'UpdateFcn' callback?

 采纳的回答

Does dbstop if caught error trigger it? It's likely there's a try/catch catching the original exception and thus not throwing one to be stopped on. dbstop if caught error will catch this too.

更多回答(0 个)

类别

帮助中心File 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