I'm using a code to pass values between guis. The first time it worked flawlessly, but the second time it neither gave me the output nor an error. Please help!

2 visualizaciones (últimos 30 días)
This is the code I used. I found this answer submitted by Geoff Hayes in another similar question. The handle visibilty has been changed to on and the tags of my figures have been changed to their respective names. What am i doing wrong?
function pushbutton1_Callback(hObject, eventdata, handles)
% get the handle of Gui1
h = findobj('Tag','Gui1');
% if exists (not empty)
if ~isempty(h)
% get handles and other user-defined data associated to Gui1
g1data = guidata(h);
% maybe you want to set the text in Gui2 with that from Gui1
set(handles.text1,'String',get(g1data.edit1,'String'));
% maybe you want to get some data that was saved to the Gui1 app
x = getappdata(h,'x');
end
  6 comentarios
Geoff Hayes
Geoff Hayes el 19 de Mzo. de 2016
Editada: Geoff Hayes el 19 de Mzo. de 2016
Preethi - when you try to get the values from openingpagedemo, is this GUI still available (i.e. visible to the user) or have you closed it? If it has been closed, then you will not be able to obtain the length and width from it.
Preethi Thomas
Preethi Thomas el 19 de Mzo. de 2016
Editada: Preethi Thomas el 7 de Abr. de 2016
Geoff, Yes I was closing it when I moved to page1. I never realised that page1 was never shut which was why it worked. Thank you!!! Now it works perfectly. :)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Data Type Identification en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by