<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169183</link>
    <title>MATLAB Central Newsreader - Callback Cross close function</title>
    <description>Feed for thread: Callback Cross close function</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The 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>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 13 May 2008 15:11:44 -0400</pubDate>
      <title>Callback Cross close function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169183#431819</link>
      <author>Luca Cerone</author>
      <description>Hi,&lt;br&gt;
I'm developing a compiled GUI application.&lt;br&gt;
It works fine, but I have a problem:&lt;br&gt;
I can't succeed in making the program to free memory when i&lt;br&gt;
close it clicking on the X (cross) button of my application.&lt;br&gt;
&lt;br&gt;
How can I write a callback for the X button?&lt;br&gt;
How can I deallocate all memories, destroy all classes and&lt;br&gt;
free memory (is a clear all enough before of returning?)&lt;br&gt;
If you could help me, I would be very grateful!&lt;br&gt;
Thank you very much in advance!!! -Luca-&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 13 May 2008 16:21:04 -0400</pubDate>
      <title>Re: Callback Cross close function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169183#431845</link>
      <author>helper </author>
      <description>"Luca Cerone" &amp;lt;cerone@to-see.it&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g0cb3g$17m$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; I'm developing a compiled GUI application.&lt;br&gt;
&amp;gt; It works fine, but I have a problem:&lt;br&gt;
&amp;gt; I can't succeed in making the program to free memory when &lt;br&gt;
i&lt;br&gt;
&amp;gt; close it clicking on the X (cross) button of my &lt;br&gt;
application.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How can I write a callback for the X button?&lt;br&gt;
&amp;gt; How can I deallocate all memories, destroy all classes and&lt;br&gt;
&amp;gt; free memory (is a clear all enough before of returning?)&lt;br&gt;
&amp;gt; If you could help me, I would be very grateful!&lt;br&gt;
&amp;gt; Thank you very much in advance!!! -Luca-&lt;br&gt;
&lt;br&gt;
To start with, use the "CloseRequestFcn" of the figure to &lt;br&gt;
specify a callback function for whenever the figure is &lt;br&gt;
requested to close (including using the X button).  Note &lt;br&gt;
that at the end of this function, use the DELETE function &lt;br&gt;
to actually delete the figure.&lt;br&gt;
&lt;br&gt;
As far as I know, CLEAR ALL is unnecessary to clear &lt;br&gt;
variables from memory.  Having the executable quit should &lt;br&gt;
be enough to handle this.&lt;br&gt;
&lt;br&gt;
However, things such as timers, serial objects, and OOP &lt;br&gt;
classes need to be carefully considered during their &lt;br&gt;
creation to ensure the appropriate cleanup and deletion &lt;br&gt;
occurs during the "CloseRequestFcn".  I do not believe &lt;br&gt;
there is any command within MATLAB to automatically cleanup &lt;br&gt;
and delete everything.&lt;br&gt;
&lt;br&gt;
Note that the method for "cleaning up" things which require &lt;br&gt;
it are well documented within MATLAB.  For example, check &lt;br&gt;
out the documentation for TIMER and SERIAL.  They both show &lt;br&gt;
the necessary "cleanup" steps.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 13 May 2008 16:46:05 -0400</pubDate>
      <title>Re: Callback Cross close function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169183#431852</link>
      <author>Luca Cerone</author>
      <description>&amp;gt; To start with, use the "CloseRequestFcn" &lt;br&gt;
Thanks I just found it on Matlab Help 2 minutes ago ^_^&lt;br&gt;
&lt;br&gt;
&amp;gt; As far as I know, CLEAR ALL is unnecessary to clear &lt;br&gt;
&amp;gt; variables from memory.  Having the executable quit should &lt;br&gt;
&amp;gt; be enough to handle this.&lt;br&gt;
&lt;br&gt;
I don't know why, but even using delete I get a warning say&lt;br&gt;
something about UiOpenFileDialog class that is still exists&lt;br&gt;
and won't be clean up...&lt;br&gt;
&lt;br&gt;
&amp;gt; Note that the method for "cleaning up" things which require &lt;br&gt;
&amp;gt; it are well documented within MATLAB.  For example, check &lt;br&gt;
&amp;gt; out the documentation for TIMER and SERIAL.  They both show &lt;br&gt;
&amp;gt; the necessary "cleanup" steps.&lt;br&gt;
&lt;br&gt;
I'll try looking for Cleanup in Matlab Help (I'm sorry if I&lt;br&gt;
ask something stupid, but the fact is that for a non-english&lt;br&gt;
speaker, sometimes it's difficult to use the right wordkey&lt;br&gt;
for search!)&lt;br&gt;
&lt;br&gt;
Thank you very much in advance!&lt;br&gt;
Hope to see you soon!&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
