I have a GUI created using MATLAB GUIDE. I am trying to return a value from the GUI. Here are the relevant parts of the code (complete code can be found here):
function varargout = test(varargin)
% --- Outputs from this function are returned to the command line.
function varargout = test_OutputFcn(hObject, eventdata, handles)
% Get default command line output from handles structure
varargout{1} = handles.output;
varargout{2} = handles.test;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
handles.test = 'ok';
% Update handles structure
guidata(hObject, handles);
And as soon as I execute the GUI, I get this error message:
I found a similar question on the MATLAB newsgroup, but I didn't find a solution (and I read all the guidata's doc, like suggested).
My problem is that I recorded an information in the "handles" structure within one GUIDE's function and I can't retrieve this information in another function.
I tried to un-comment the UIWAIT call in the test_OpeningFcn
function in an attempt to wait for the user to close the window.
% --- Executes just before test is made visible.
function test_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for test
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes test wait for user response (see UIRESUME)
uiwait(handles.figure1);
After I click in button, and then try to take the handle variable. But it doesn't work either and fails with a similar error message.
Any help will be welcome. Thanks for your attention.