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?

 채택된 답변

Sean de Wolski
Sean de Wolski 2014년 12월 12일

2 개 추천

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에 대해 자세히 알아보기

질문:

2014년 12월 12일

댓글:

2014년 12월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by