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

조회 수: 1 (최근 30일)
Gowrishankar R
Gowrishankar R 2015년 5월 17일
댓글: Gowrishankar R 2015년 5월 18일
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