Hey,
I'm still struggling passing variables from one GUI to another by using handles.
I have created a GUI called "main" including a push button "OK" and an edit text box "a". Using "OK" will open a secong GUI "main2" which is supposed to return a variable "e".
function OK_Callback(hObject, eventdata, handles)
uiwait(main2);
e = handles.e;
set(handles.a,'string',e);
end
In "main2" I have a variable "e" being calculated in a function "calculate" which is being called after typing a number into the edit text box taged "d". By debugging I found out that "Calculate" returns the correct value. All cool so far.
function e = calculate(c,d)
e = c + d;
end
function d_Callback(hObject, eventdata, handles)
c = str2double(get(handles.c,'string'));
d = str2double(get(handles.d,'string'));
handles.e = e;
set(handles.e,'string',e);
guidata(hObject,handles);
uiresume;
end
What I'm struggling with is: How do I get "e" (or its handle) from "main2" into "main"? Also set(handles.e,'string',e) is not working.
Anybody knows what's going on here?
Thank heaps for any help!
1 Comment
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/105270-how-do-i-pass-variables-from-one-gui-to-another#comment_452816
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/105270-how-do-i-pass-variables-from-one-gui-to-another#comment_452816
Sign in to comment.