Passing data between two different GUI windows

I am a beginner with MATLAB GUIs. I have two GUI figure windows. I want to transfer data from a textbox in the first GUI figure to another second GUI figure & want to use that data in second GUI figure.

 채택된 답변

Matt Fig
Matt Fig 2011년 4월 12일

1 개 추천

Assuming you are using GUIDE to generate your GUIs, you can simply use the tag of the editbox in the first GUI to find it in the second GUI. For example, from within the second GUI callback use:
findall(0,'tag','editbox1tag')

댓글 수: 5

SUDIP PODDAR
SUDIP PODDAR 2011년 4월 13일
Thanks for your answer. But if you tell me the total code then it will easy for me. My question is I have two gui figure each having a textbox. I want to take the text from the textbox of first figure & then want to transfer it into the textbox in the second gui figure.
Matt Fig
Matt Fig 2011년 4월 13일
I assume you are pushing a button in the second GUI to activate the transfer? If so, put this (or similar) in the callback to the pushbutton:
H = findall(0,'tag','editbox1tag');
set(handles.editbox2tag,'string',get(H,'string'))
Now 'editbox1tag' is the tag to the editbox in the first GUI (which must be unique), and editbox2tag is the tag to the editbox in the second GUI (also unique).
SUDIP PODDAR
SUDIP PODDAR 2011년 7월 20일
If i use the pushbutton in the first gui to activate the transfer, then what i do Sir. Plz help me as soon as possible.
seemal
seemal 2012년 2월 13일
Matt i had the same question.
H = findall(0,'tag','editbox1tag');
set(handles.editbox2tag,'string',get(H,'string'))
Allows me to pass the between GUIs but i can't manipulate them. I think they are string values of the data i want. I've tried using str2num and str2double but i can't perform any operations on the called back values.
Help!!
nur ilham
nur ilham 2013년 3월 6일
hye. can I ask what should i put in the 'tag' at the H = findall(0,'tag','editbox1tag');

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ned Gulley
Ned Gulley 2011년 4월 12일

0 개 추천

Here's a tricky non-Guide way to do it. Change the data in the text box and press return to plot the data in figure 2.
% Make figure 1
f1 = figure('Name','Window 1');
% Make figure 2
f2 = figure('Name','Window 2');
% Make the axes in figure 2
a2 = axes('Parent',f2);
% Create a plot function (uses anonymous function syntax)
plotf = @() plot(findobj('Type','axes','Parent',f2),str2num(get(gcbo,'String')));
% Create the edit box
u1 = uicontrol(f1, ...
'Style','edit', ...
'String','[1 2 4 3 5]', ...
'Callback','feval(plotf)');

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by