Clear Filters
Clear Filters

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

1 view (last 30 days)
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).

Accepted Answer

Walter Roberson
Walter Roberson on 17 May 2015
  1 Comment
Gowrishankar R
Gowrishankar R on 18 May 2015
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?

Sign in to comment.

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!