I have a GUIDE generated UI in which I have wired up one of computed values, to handles and return it through automatically generated callback OutputFcn. When I run my UI, it computes the value and returns it to the command window immediately. The UI has interactive controls which will modify the output value, but it is not returned after the interactive controls are manipulated.
When I add uiwait(handles.figure1), then OutputFcn is not called until close, which is the desired behavior. Unfortunately when I do this the handles passed into OutputFcn is empty. When I omit the uiwait command from OpeningFcn, then the handles object passed to OutputFcn is populated as expected.
It seems that if OutputFcn is called while the figure is still open, then the handles object exists and can be referenced, however, if OutputFcn is not called until I close the figure, then the handles object points to a closed figure and I can no longer reference it.
Any advice to resolve this? Thanks!