External functions (with a GUI)
11 views (last 30 days)
Jakob Sørensen on 20 Feb 2012
I'm currently working on a GUI, that has to show images in 3 different axes. I have no problem handling it insides the main *.m file for the GUI, but if i try to put the plotting code in a file for itself, then I can't use "axes(handles.axes1)" because handles, apparently, only can be accessed from the main file. Is there anyway to cope with this? And preferably something somewhat refined, since this is for my bachelor degree.
Thanks in advance
Chandra Kurniawan on 20 Feb 2012
Maybe this will helps.
I have GUI as shown in picture below :
For button "GRAY" and "BINARY", I perform image convertion with external functions.
I also call 'imshow' from external functions.
Here code about the main interface :
function pushbutton1_Callback(hObject, eventdata, handles)
handles.I = imread('peppers.png');
function pushbutton2_Callback(hObject, eventdata, handles)
handles.J = rgb_to_gray(handles.I,handles.axes2);
function pushbutton3_Callback(hObject, eventdata, handles)
handles.K = im_to_bw(handles.J,handles.axes3);
And here the external functions
function J = rgb_to_gray(I,handles)
J = rgb2gray(I);
function J = im_to_bw(I,handles)
J = im2bw(I);
I hope this will helps