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

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.

Answers (2)

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 Comments

"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."
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.
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).

This question is closed.

Asked:

on 25 Sep 2018

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!