QUESTION :
I’m doing a lot of simulations in Matlab in Windows XP. Typically I always have one Matlab open that runs a lenghty simulation while I do my work in another instance.
There are some annoyances. If I accidently click the “working” window name in task bar it will keep being marked yellow forever ( an hour or so ) and if I accidently rightclick on it a context menu will show – but never disappear. Covering other windows – most annoying.
I’m wondering are there tips how to make such a context menu disappear without killing my calculation.
Basically it will look like this forever:
So far I learnt that if I put some wait(0.1)
commands in my code it will prevent this, but also horribly slow down my calculations. Therefore I don’t consider it an option.
ANSWER :
I would assume, by default, Matlab runs your simulation on the user interface thread. So while you’re simulating, there is no time to handle anything related to the UI.
To work around this, you would have to instruct Matlab to run your simulations on a new thread. I found some bits on SO about this:
Information found on Google also seems to point in the direction of the Parallel Computing Toolbox.
This is basically a byproduct the design of Windows – Applications receive “messages” in response to UI events and it is up to application to do things like repaint its window, resize, etc.
Windows will send the application the appropriate “messages” in response to events such as UI clicks, etc., but the application is allowed to completely ignore them and typically badly designed/ported applications might do that.
An application designed to “feel” interactive will A) interrupt what it is doing at various moments to process such messages, or B) have a separate thread that does the actual work. I can see where “feeling interactive” is not design priority of some applications, and if the application is in fact a development environment to run your own programs then the responsibility to “feel interactive” falls on you. I’ve played with Visual Studio and running programs that accidentally creating endless loops causing the application’s CPU usage to shoot up to 100% does similar things with the UI.
I can’t think of the name of any of these programs now but there are some programs out there that will let you do the “multiple workspace” thing like a lot of Linux desktops have. If you can put your instances of MATLAB in separate workspaces using such a program it might help prevent you from accidentally clicking on it.