Break a code in intermediate function

조회 수: 6 (최근 30일)
Marcelo Sena
Marcelo Sena 2015년 1월 24일
댓글: Sean de Wolski 2015년 1월 26일
Hi, I am trying to break a code in an intermediate function of the whole procedure I am running. For example, I run "my_script.m" which calls an intermediate function "my_function.m". I would like to break/pause the code at line 15 of "my_function.m". It is basic programming feature, but (surprsingly) couldnt do it or find quick instructions in the internet. I am grateful for any help. Thanks.

채택된 답변

Star Strider
Star Strider 2015년 1월 24일
Would the pause function do what you want? Also, see the list of related functions at the end of that page.
  댓글 수: 3
Marcelo Sena
Marcelo Sena 2015년 1월 25일
Ok, just found the problem. I had a clear all which was clearing the break code.
Star Strider
Star Strider 2015년 1월 25일
My pleasure.
What do you want to do with the paused code? What do you want to do at Line 15 of "my_function.m"?
If you want to examine or change a variable, another option is inputdlg and its friends (listed in and at the end of that page). One benefit of inputdlg is that it and its friends don’t clutter the Command Window.

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

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2015년 1월 24일
편집: Sean de Wolski 2015년 1월 26일
>>dbstop in my_function at 15
Or click the - next to the line number in the editor. Doc:
>>web(fullfile(docroot, 'matlab/matlab_prog/debugging-process-and-features.html'))
  댓글 수: 3
Marcelo Sena
Marcelo Sena 2015년 1월 24일
By the way, setting the breakpoint with the mouse does not work. The file just continues until the error line.
Sean de Wolski
Sean de Wolski 2015년 1월 26일
Just run the above at the command line.

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

카테고리

Help CenterFile 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