Is there a way to know what line is matlab executing at an instant without obviously terminating the code?

I wrote a code for obtaining the quantizer levels for 1 to 10 bits. It has been running since yesterday and has generated levels for 9 bits(displayed). But I think it has stopped responding now but still i m not sure.

Answers (3)

Sorry, there is no way to pause MATLAB to find out what it is doing (not unless you had already designed that capacity in.)
You can issue the "echo on" command but that will really slow down your code.

2 Comments

Unfortunately if you have started something running, you need to wait until you get the command prompt back before you can "echo on"
Yes. I was thinking he'd just have to stop it and restart it to find where it gets "stuck." Otherwise it's probably in an infinite loop or hung and he may have to wait an eternity, so there's no other way than restarting. Hopefully that won't be a big problem. It will likely get stuck at the same place during the second run. But I think a better method is to just write something out the the command line at key places (like Jan said), which will not slow it down as much as echo.

Sign in to comment.

How much CPU time does the process take currently? The operating system offers methods to check this. Unfortunately this could mean an infinite loop also, but if so, there is no chance to check this without implementing a mechanism before - some output to the command window, a progressbar, etc.

Categories

Asked:

on 3 Jul 2012

Community Treasure Hunt

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

Start Hunting!