Setting Breakpoints in Embedded Functions

Isn't there a way to set a breakpoint in a function embedded in another function embedded in another function, etc etc and have the Matlab debugger go directly to this breakpoint? Currently, I have to put breakpoints at every single function call, step in to the function, set a breakpoint to stop at the next level function call etc, etc and I can't figure out how to go straight to the desired breakpoint in the multi-level embedded function.

 채택된 답변

Jan
Jan 2013년 9월 26일
편집: Jan 2013년 9월 26일

0 개 추천

What is an "embedded function"? Do you mean a "nested" function? What happens if you set a breakpoint where you want it?
Do you have a clear all in your code, which deletes all breakpoints? If so, and if you do not want to avoid debugging in general, remove the clear all. It is a painful junk at all when written to functions or scripts, while I see many users, who call it cleanly from the command line.
A hard-coded breakpoint is inserting a keyboard command. While this is bullet-proof and not impressed by clearing, it is less convenient, because you have to care for a clean removal of these lines for the productive code. But applying changes to the code after debugging is a bad programming practice in general, because any modification could add a new bug and therefore an exhaustive testing must follow afterwards again...

댓글 수: 1

Shari
Shari 2013년 9월 26일
Jan,
Yes, I meant "nested" functions. I only have one "clear all" and it is at the very top of my main program and not others. If I set a breakpoint in a nested function (say 4 levels down), it just runs all the way through the code, crashes, and never stops at that breakpoint. I can only get it to stop at a breakpoint if that breakpoint is within the main program or within a nested function if I have already stepped into that nested function.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

질문:

2013년 9월 26일

댓글:

2013년 9월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by