How to call a function with a GUI push button
Show older comments
I would like to create a GUI that performs a set of specified operations (defined in a separate function) on an image chosen by the user. So far, I have been able to use a push-button and the "uigetfile" function to prompt the user to select an image. This image is then displayed onto the GUI axes. How do I link my separate function called "Cell_Recognition.m" to a second GUI push-button that runs the desired operations on a user specified image and displays the updated image to the axes?
Here is the GUI Guide code of the involved sections:
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
[bfn, folder] = uigetfile('*.*','Select an Image for Analysis')
Name = fullfile(folder, bfn)
I = imread(Name)
image(I)
guidata(hObject,handles)
The first pushbutton performs as desired and loads the image into the axes
% --- Executes on button press in pushbutton2.two
function pushbutton2_Callback(hObject, eventdata, handles)
Cell_Recognition(I)
How do I run the user specified image through the function Cell_Recognition.m and display the new image to the axes by clicking a second push button?
Thanks in advance!!
Accepted Answer
More Answers (0)
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!