How can I attach to a running Matlab script (i.e. a m-file which I have executed with F5 ) ? It runs since days (I have an infinite while loop) and I want to understand what is wrong (it should exit it at some point). I know I can rerun it and set a breakpoint but that is not what I am asking. I wanna set a breakpoint NOW inside the loop and stop the process and debug it. Matlab does not allow me to set a breakpoint.
Unfortunately Matlab does not allow this. To work around this problem I call this function at critical points in a project:
function cxdebug()
f='c:\cxdebug';
if exist(f,'file')
try, delete(f);end
keyboard;
end
end
Once you created the file, matlab will enter the debugger when the function is called next time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With