Passing data between two different GUI windows

1 visualización (últimos 30 días)
SUDIP PODDAR
SUDIP PODDAR el 12 de Abr. de 2011
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.

Respuesta aceptada

Matt Fig
Matt Fig el 12 de Abr. de 2011
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 comentarios
seemal
seemal el 13 de Feb. de 2012
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 el 6 de Mzo. de 2013
hye. can I ask what should i put in the 'tag' at the H = findall(0,'tag','editbox1tag');

Iniciar sesión para comentar.

Más respuestas (1)

Ned Gulley
Ned Gulley el 12 de Abr. de 2011
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)');

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by