How to call a custom functions in GUI? (image processing)
显示 更早的评论
good day everyone,
i have a question regarding GUI. please excuse me if my question is too easy or too foolish. i am still new to matlab, so i hope someone can give me a guidance on this.
i've made a coding that is simplified into several functions. the first task is to select the desired image,(i use imgetfile in this situation). next is to do segmentation process which i saved it as a function. my question is, how do i do the callback so that that image can be read into my segmentation function?
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im im2;
[impath, user_canceled] = imgetfile;
if user_canceled
msgbox(sprintf('Cancelled by user!\nOperation could not be completed'),'error','error');
return;
end
% filename=impath
filename=impath;
setappdata (0,'filename',filename);
a=imread(impath);
% setappdata (a,'FileName',impath)
axes(handles.originalim);
imshow(a);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'filename');
FileName=a
badrulsegmentation (a);
this is my first time doing GUI, and i dont seem to understand how this works. please help me
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!