Breakpoints in code. Something equivalent to the Stop command in interpreted Basic.
34 次查看(过去 30 天)
显示 更早的评论
I'm wanting to put permanent breakpoints in code. Something equivalent to the Stop command in interpreted Basic. As with the Editor's breakpoints, I want the cursor to be at the interruption point. And I want to continue with F5. Any ideas?
0 个评论
采纳的回答
Steven Lord
2017-3-6
Use the keyboard function.
3 个评论
Steven Lord
2017-3-6
If you have the Editor/Debugger preference "Automatically open files when MATLAB reaches a breakpoint" enabled (in the "General Preferences for the Editor/Debugger" section of this documentation page) it will automatically open the file in which the keyboard command is called to the line where it is called.
更多回答(1 个)
Walter Roberson
2017-3-6
编辑:KSSV
2021-2-10
8 个评论
Ivan Nascimento
2021-7-8
编辑:Ivan Nascimento
2021-7-8
Walter's STOP worked perfectly for me but only once I changed str2num to num2str, since dbstop receives a string as argument and ST(2).line is double. It works even when it is called before a comment or blank line (it stops in the next executable line, if it exists). Thank you, Walter!
EDIT. From dbstop help: To resume execution, use dbcont or dbstep. To exit from the debugger, use dbquit.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!