From: Grant Coleman on
"Borer " <febex2008(a)gmail.com> wrote in message <hkah45$5jk$1(a)fred.mathworks.com>...
> Hello, everyone out there!
> The "problem" with the data being deleted when closing the figure also happened to me. I tried several techniques, like calling the output callback in the CloseRequest callback. But nothing worked!! It appears that the function gui_mainfcn() deletes the data before assigning the output to varargout.... (This happens in the following section of the M-file of the GUI)
>
> if nargout
> [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
> else
> gui_mainfcn(gui_State, varargin{:});
> end
>
>
> After thinking quite a while I found a workaround to fix this problem.
> ->Create a CloseRequestFcn Callback
> Don't delete the figure there!!!! Just do a uiresume(handle)!!!!
>
> ->In the OutputFcn, assign your outputs you need and at last do the delete(hObject) which will close the GUI.
>
> In this way the "gui_mainfcn" will call the output function which will delete the figure after assigning the outputs.
>
> I hope this helps.
Wow - thanks a lot!

this certainly helps.

Grant