I am new to GUI programming for MATLAB, so my question is related to this.
Let's say that I am creating a GUI with GUIDE. In the create function
MyGUI_OpeningFcn(hObject, eventdata, handles, varargin)
I am calling another function,
SamplingRate_Callback(handles.SamplingRate, eventdata, handles)
defined as
function SamplingRate_Callback(hObject, eventdata, handles)
SamplingRate_Callback sets several variables,
handles.a = 1;
handles.b = 2;
handles.c = 3;
The structure is handlesupdated correctly in the function SamplingRate_Callback. The problem I am facing is that if I do not change the function to
function handles = SamplingRate_Callback(hObject, eventdata, handles),
I can not return data to the calling function MyGUI_OpeningFcn. I tried using guidata(gcf, handles)and guidata(hObject, handles)but does not work.
Could you shed some light on this problem?
Also, I'm not sure when to use guidata(gcf, handles)vs.. guidata(hObject, handles).
Thank you for your help!