Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I know if Matlab is busy when using GUIs?

I've created a small GUI to manipulate data and recently I decided to move the database to a MySQL server. I created a Java program to bring the data back and forth and I started to notice the delay when access servers abroad.

When you run scripts through the command window Matlab displays a "busy" text in the lower left corner but not when I'm running GUIs.

So how do I know if Matlab is busy when using GUIs?

Thanks in advance.

Edit: Quick example.

I run in the command window (or a script test.m)

for i = 1:100000
  a = i+i;
  disp(a);
end

The status bar says "Busy".

When I create a GUI, with the button "Click me" that executes the same exact script. The busy sign on the status bar does not appear.

Why is this and what can I do about it? I want to be able to see if my GUI is busy or not.

like image 445
Stefan Gretar Avatar asked Jan 22 '12 12:01

Stefan Gretar


4 Answers

It says so in the status bar of the main window!

EDIT:
So the answer is no, right now there is no way to (easily) say if matlab is busy doing something other than a command line job.

like image 102
Ali Avatar answered Sep 28 '22 07:09

Ali


You should be able to modify the status bar message of the main MATLAB window using the submission statusbar from Yair Altman on the MathWorks File Exchange. He discusses how it works in a post on his blog "Undocumented Matlab".

With this utility, you should be able to put up a "Busy..." message even when MATLAB doesn't do it automatically. Your code for the "Click me" button callback would probably look something like this:

...
statusbar(0, 'Busy...');  %# Set the status message
test;                     %# Run your function/script
statusbar(0, '');         %# Clear the status message
...
like image 38
gnovice Avatar answered Sep 28 '22 07:09

gnovice


You could add a static text on the GUI itself and set its text to 'Busy'/'Idle' before/after your calculations are done, if making the GUI more user-friendly is the concern.

like image 23
vishalvr9 Avatar answered Sep 28 '22 07:09

vishalvr9


Probably what you are looking for:

Enter any arbritary code into the command line.

e.g. somthing like

asdfasdfasdfasdf

If the GUI routine is still running, then it will display busy, until the GUi function has ended. Only then it can start to execute asdfasdfasdfasdf.

If the Gui is already finished, then it will execute asdfasdfasdfasdf instantaneously and display the according error message.

Earlier all Matlabs displayed also the busy message, when beeing executing a Gui-started function. Since 2012 this seems no longer to be the case.

like image 44
hemmi7 Avatar answered Sep 28 '22 08:09

hemmi7