当我调试长篇数值代码时,通常我想要在发生某些情况或在特定迭代中查看函数变量值。一般我会这样做:
function banana(platano)
% long stuff here
for ii=1:123456789
% tons of maths
if ii==45612
stophere=1; % I put a break point in this line of code
end
end
然而,这需要我在函数中编写代码进行调试,看起来不太好。有没有更聪明的方法来解决这个问题?
dbstop in file if condition
→ 在文件中的条件下停在某个位置 - Dev-iL@rayryeng dbstop在第8行的banana函数中,当ii等于454345433时停止调试。
- Luis Mendo