Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How can I call the data from one GUI and display it in another GUI without saving the data in a txt file?

1 visualización (últimos 30 días)
Below are my file, i can load the image after i save my uploaded image and use 'imread' in MY second GUI but i want to display the data straight from the previous GUI after i click a button to another GUI. "untitled1.m" and "well.m" is my second GUI.

Respuestas (2)

Adam Danz
Adam Danz el 25 de Sept. de 2018
Editada: Adam Danz el 26 de Sept. de 2018
If your GUI was made using GUIDE, you can call any callback function within the GUI's m-file from outside of that file. Say your GUI's m-file is named myGUI.m with a function within the file named buttonCallback(). From outside of the file, you can execute the code
MyGUI('buttonCallback',hObject,eventData,handles,...)
which includes all inputs to the buttonCallback() function.
  3 comentarios
Stephen23
Stephen23 el 26 de Sept. de 2018
Editada: Stephen23 el 26 de Sept. de 2018
"If your GUI was made using GUIDE, you can call any nested callback function ..."
GUIDE does not use nested functions, it only uses local functions. Not only that, the MATLAB documentation specifically states that nested functions are "Not recommended for GUIDE apps."
Adam Danz
Adam Danz el 26 de Sept. de 2018
Editada: Adam Danz el 26 de Sept. de 2018
Stephen is right. I'll edit my poor word choice.
In my example, I am calling a callback function from a 2nd GUI from within my 1st GUI.

Stephen23
Stephen23 el 26 de Sept. de 2018
Editada: Stephen23 el 26 de Sept. de 2018
This is simple using guidata, or setappdata and getappdata: instead of using the handle of the callback object as you normally would, you can pass it the handle of the graphics root, so that whatever you store there will be available to all graphics objects. Note that you should not store all of the GUI data (i.e. handles) in the root, just the few bits of data that you want to swap between GUI's, and these should probably be stored in a structure (much like handles).

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by