<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157332</link>
    <title>MATLAB Central Newsreader - GUI: hangs up</title>
    <description>Feed for thread: GUI: hangs up</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 08 Oct 2007 16:15:53 -0400</pubDate>
      <title>GUI: hangs up</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157332#395615</link>
      <author>Yogesh </author>
      <description>Hello!&lt;br&gt;
I have a problem with a GUI running in MATLAB 7.0. It hangs&lt;br&gt;
when I execute minimization routine through it. The&lt;br&gt;
description of GUI is as follows.&lt;br&gt;
&lt;br&gt;
The GUI is created using GUIDE for least squares&lt;br&gt;
minimization code. The code determines model parameter by&lt;br&gt;
minimizing the difference between observed and model&lt;br&gt;
predicted values. The GUI preprocesses the data, set&lt;br&gt;
minimization solver options and plots end results . The top&lt;br&gt;
level figure contains  6 uipanels which in turn contains&lt;br&gt;
several uicontrol objects like editable text, push button,&lt;br&gt;
etc and menubar. To simulate TAB like environment each&lt;br&gt;
uipanel is made visible when corresponding panel name is&lt;br&gt;
selected in menubar and other visible status of other&lt;br&gt;
uipanels is set to 0.&lt;br&gt;
&lt;br&gt;
Snapshots of this GUI can be seen at &lt;br&gt;
&lt;a href=&quot;http://www.mip.ups-tlse.fr/~parte/MATLAB_PROBLEM/GUI_Details.pdf&quot;&gt;http://www.mip.ups-tlse.fr/~parte/MATLAB_PROBLEM/GUI_Details.pdf&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The problem is when I start running the minimization solver,&lt;br&gt;
which performs number of iterations,  the GUI figure doesn't&lt;br&gt;
show uicontrol object properly (See the last snapshot) and I&lt;br&gt;
get message that GUI is not responding.&lt;br&gt;
&lt;br&gt;
After every iteration the solver updates the listbox and&lt;br&gt;
progress bar. There is a STOP button to stop solver on user&lt;br&gt;
demand. When iterations are being carried out, the GUI&lt;br&gt;
doesn't respond immediately. However if iterations are&lt;br&gt;
interrupted using CNTRL+C at command prompt, all uicontrol&lt;br&gt;
objects are visible and one can see that listbox panel and&lt;br&gt;
progress bar is updated till latest iterations. (See&lt;br&gt;
snapshot on page 2)&lt;br&gt;
&lt;br&gt;
I tried using &quot;drawnow&quot; function at the end of iteration but&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;the problem persists. What could be the reason behind&lt;br&gt;
this? Is it possible to overcome this behaviour and provide&lt;br&gt;
clean GUI? &lt;br&gt;
&lt;br&gt;
The datasets being used are small, about 600 observations&lt;br&gt;
and model used is simple which has 15 parameters and&lt;br&gt;
involves inversion of 5X5 matrix (carried out usig &quot;/&quot;&lt;br&gt;
operator).&lt;br&gt;
The laptop on which code is run has 2GB RAM, &lt;br&gt;
Intel Core 2 duo, T7200, 2GHZ processor.&lt;br&gt;
Java VM Version: Java 1.4.2_04 with Sun Microsystems Inc. &lt;br&gt;
YP&lt;br&gt;
---</description>
    </item>
    <item>
      <pubDate>Wed, 17 Oct 2007 15:02:33 -0400</pubDate>
      <title>Re: GUI: hangs up</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157332#397171</link>
      <author>Fangjun Jiang</author>
      <description>I had this problem in various versions of Matlab in many &lt;br&gt;
occations. Now I know how to deal with it.&lt;br&gt;
&lt;br&gt;
I have an educated guess for the cause of the problem. In &lt;br&gt;
the code, after the user giving inputs through GUI, if &lt;br&gt;
there are intensive calculations need to be executed, the &lt;br&gt;
GUI windows usually freeze. I did a test. I had a dialog &lt;br&gt;
window created by questdlg() which has two buttons (&quot;Yes&quot; &lt;br&gt;
and &quot;No&quot;). If user clicks &quot;Yes&quot;, the program do some &lt;br&gt;
intensive calculation. If user clicks &quot;No&quot;, the program is &lt;br&gt;
ended. When I run the test, if I click &quot;No&quot;, all seem &lt;br&gt;
nomal. If I click &quot;Yes&quot;, the dialog window got stuck. The &lt;br&gt;
CPU usage in the task manager flares up but the CPU is not &lt;br&gt;
running my intensive calculation because if it does, there &lt;br&gt;
shall be some display in the Matlab command window. It &lt;br&gt;
took a while for the computer to get out of the freezed &lt;br&gt;
window and start to run the intensive calculation. &lt;br&gt;
&lt;br&gt;
So the problem is that the computer doesn't have enough &lt;br&gt;
time to refresh the GUI. Sometimes, I started to click &lt;br&gt;
other windows of other application such as IE, Word, etc. &lt;br&gt;
which makes it worse. In some cases, I can't wait any &lt;br&gt;
longer so I just kill the Matlab application.&lt;br&gt;
&lt;br&gt;
There are suggestions that adding a &quot;drawnow&quot; statement &lt;br&gt;
after the GUI function (questdlg() statement in my case) &lt;br&gt;
could solve the problem. I tried but it didn't work well.&lt;br&gt;
&lt;br&gt;
My solution is to add a pause(0.2) statement instead of &lt;br&gt;
drawnow statement. It works every time.</description>
    </item>
    <item>
      <pubDate>Wed, 17 Oct 2007 15:02:42 -0400</pubDate>
      <title>Re: GUI: hangs up</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157332#397172</link>
      <author>Fangjun Jiang</author>
      <description>I had this problem in various versions of Matlab in many &lt;br&gt;
occations. Now I know how to deal with it.&lt;br&gt;
&lt;br&gt;
I have an educated guess for the cause of the problem. In &lt;br&gt;
the code, after the user giving inputs through GUI, if &lt;br&gt;
there are intensive calculations need to be executed, the &lt;br&gt;
GUI windows usually freeze. I did a test. I had a dialog &lt;br&gt;
window created by questdlg() which has two buttons (&quot;Yes&quot; &lt;br&gt;
and &quot;No&quot;). If user clicks &quot;Yes&quot;, the program do some &lt;br&gt;
intensive calculation. If user clicks &quot;No&quot;, the program is &lt;br&gt;
ended. When I run the test, if I click &quot;No&quot;, all seem &lt;br&gt;
nomal. If I click &quot;Yes&quot;, the dialog window got stuck. The &lt;br&gt;
CPU usage in the task manager flares up but the CPU is not &lt;br&gt;
running my intensive calculation because if it does, there &lt;br&gt;
shall be some display in the Matlab command window. It &lt;br&gt;
took a while for the computer to get out of the freezed &lt;br&gt;
window and start to run the intensive calculation. &lt;br&gt;
&lt;br&gt;
So the problem is that the computer doesn't have enough &lt;br&gt;
time to refresh the GUI. Sometimes, I started to click &lt;br&gt;
other windows of other application such as IE, Word, etc. &lt;br&gt;
which makes it worse. In some cases, I can't wait any &lt;br&gt;
longer so I just kill the Matlab application.&lt;br&gt;
&lt;br&gt;
There are suggestions that adding a &quot;drawnow&quot; statement &lt;br&gt;
after the GUI function (questdlg() statement in my case) &lt;br&gt;
could solve the problem. I tried but it didn't work well.&lt;br&gt;
&lt;br&gt;
My solution is to add a pause(0.2) statement instead of &lt;br&gt;
drawnow statement. It works every time.</description>
    </item>
    <item>
      <pubDate>Wed, 24 Oct 2007 14:15:44 -0400</pubDate>
      <title>Re: GUI: hangs up</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157332#398191</link>
      <author>Yogesh </author>
      <description>Hello!&lt;br&gt;
Thank you for your reply and suggestion. But even after&lt;br&gt;
using pause command the problem persists.&lt;br&gt;
YP</description>
    </item>
    <item>
      <pubDate>Wed, 24 Oct 2007 14:28:14 -0400</pubDate>
      <title>Re: GUI: hangs up</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157332#398192</link>
      <author>Jerome Briot</author>
      <description>Yogesh a &#233;crit :&lt;br&gt;
&lt;br&gt;
&amp;gt; I tried using &quot;drawnow&quot; function at the end of iteration but&lt;br&gt;
&amp;gt;    the problem persists. &lt;br&gt;
&lt;br&gt;
Hi,&lt;br&gt;
&lt;br&gt;
did you try with REFRESH ?&lt;br&gt;
&lt;br&gt;
J&#233;r&#244;me</description>
    </item>
    <item>
      <pubDate>Thu, 25 Oct 2007 15:45:47 -0400</pubDate>
      <title>Re: GUI: hangs up</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/157332#398398</link>
      <author>Fangjun Jiang</author>
      <description>I am pretty confident that the cause of the GUI hangs up &lt;br&gt;
is the one I explained before.&lt;br&gt;
&lt;br&gt;
You seem to have a quite complex GUI. Can you step through &lt;br&gt;
your code to pinpoint the place that causes the hangs up? &lt;br&gt;
You must know the place where you give the last input to &lt;br&gt;
your GUI and your code starts to run but the GUI hangs up. &lt;br&gt;
Put a pause statement there. You have to strike a key then &lt;br&gt;
to let the code continue. See if the GUI still hangs up. I &lt;br&gt;
predict you won't have GUI hangs up when you step through &lt;br&gt;
your code.&lt;br&gt;
&lt;br&gt;
My experience is, to make the pause(0.2) work, it has to &lt;br&gt;
be added after every place where there is a need to &lt;br&gt;
refresh the GUI and there is intensive calculations &lt;br&gt;
following. Examples are like, questdlg(), inputdlg(), etc. &lt;br&gt;
For those dialog window, the window has to disappear after &lt;br&gt;
the user input. Adding a pause(0.2) statement after the &lt;br&gt;
questdlg() or inputdlg() statement prevents GUI hangs up &lt;br&gt;
in many of my cases. drawnow() or refresh() works &lt;br&gt;
sometimes but not as robust as pause().&lt;br&gt;
&lt;br&gt;
If pause(0.2) is not enough, try to increase the time, &lt;br&gt;
maybe pause(0.5).&lt;br&gt;
&lt;br&gt;
&quot;Yogesh &quot; &amp;lt;yogesh.parte.nospam@mathworks.com&amp;gt; wrote in &lt;br&gt;
message &amp;lt;ffnk2g$qmi$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello!&lt;br&gt;
&amp;gt; Thank you for your reply and suggestion. But even after&lt;br&gt;
&amp;gt; using pause command the problem persists.&lt;br&gt;
&amp;gt; YP</description>
    </item>
  </channel>
</rss>

