Problem in Debugging matlab function

조회 수: 2 (최근 30일)
Raghu Piska
Raghu Piska 2016년 9월 2일
댓글: Stephen23 2016년 9월 12일
I am running a MATLAB function which also has some other functions in it. When I start debugging this, I can step into the other function that is present in it. After stepping into the other function, I want to debug this function. But I have a very big loop (say 50 iterations ) present in it. Can I come out of that loop with out going through those 50 iterations ? ( Can I directly come out of that loop and continue with the remaining lines of the code ?). I also see that conditional break point does not work after steeping into this function.

답변 (2개)

KSSV
KSSV 2016년 9월 2일
Why don't you put debug option/ break point after the loop. As you have already debugged it till the loop.
  댓글 수: 1
Raghu Piska
Raghu Piska 2016년 9월 2일
Sir, I have two functions here. After stepping into the second function (debugging started in first function ), the debugging by default starts from the first line of the second function. I have the loop at 20th line in this (second ) function and I want to cross this loop with out clicking the mouse ( or pressing F10) for many number of times.

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


Stephen23
Stephen23 2016년 9월 2일
편집: Stephen23 2016년 9월 2일
This really is very simple:
  1. Place another breakpoint just after the loop.
  2. When the debugger reaches the loop, run dbcont or click the Continue button.
This works because within debug mode, the dbcont will run all the code until the next breakpoint. So you can simply put a breakpoint after the loop, run the "continue" command and the code will run up to the breakpoint after the loop.
  댓글 수: 3
Raghu Piska
Raghu Piska 2016년 9월 12일
Thank you sir. It is working now.
Stephen23
Stephen23 2016년 9월 12일
@PISKA RAGHU: I am glad that it is working. Please accept my answer if it resolved your problem.

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by