How to pass the image from m-file to GUI push button callback

1 次查看(过去 30 天)
hi, i am developing GUI for filter program. In my GUI i used 3 push button an 2 axes. When i press the button1 error image will display on the axes1, when i press the button2 my "filter.m" file will run. After completion my "filter.m" provide me output image in some variable called 'y'. I want to take this image i.e 'y' from "filter.m" file to GUI pushbutton3 callback, so that when i press pushbutton3 i want to display the image y on the axes2. how to do this? i mean what code i should add to "filter.m file" and to GUI pushbutton3 callback program to display the image on axes2?(i have already done coding for push button1 and 2).

采纳的回答

Walter Roberson
Walter Roberson 2015-5-17
  1 个评论
Gowrishankar R
Gowrishankar R 2015-5-18
thank you for your suggestion.. based on that i modified my gui program. now instead of calling m filter program in pushbutton2 callback, i copied and pasted my entire filter program in pushbutton2 callback. the code is as follows
function pushbutton1_Callback(hObject, eventdata, handles)
[handles.fname, handles.pname] = uigetfile('*.jpg','Select an image analysis');
Name=fullfile(handles.pname, handles.fname);
I=imread(Name);
axes(handles.axes1);
imshow(I)
set(handles.pushbutton2,'enable','on');
guidata(hObject, handles);
function pushbutton2_Callback(hObject, eventdata, handles)
{
........
160 line filter program
y=wiener();%last line of the program
}
handles.myNewVariable = y;
set(handles.pushbutton3,'enable','on');
guidata(hObject, handles);
function pushbutton3_Callback(hObject, eventdata, handles)
i am getting error in "set(handles.pushbutton3,'enable','on');" of pushbutton callback stating ??? Error using ==> set Invalid handle object. if i remove that line, i get error in next line what might be the problem? how to solve this?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by