How to Display an image on axes in push button function in gui while I have displayed another image on same axes in opening function??

6 views (last 30 days)
Hi i am working on facial expression recognition system. I have formed a gui using guide. But it provide error when I used an axes in push button function while it work well in opening function. Error is provided below.
Error using imshow>validateParent (line 301)
HAX must be a valid axes handle.
Error in imshow (line 220)
validateParent(specific_args.Parent)
Error in Expression>pb_browse_Callback (line 170)
imshow(O1,'Parent', handles.axes4)
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in Expression (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)Expression('pb_browse_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
while my opening fuction code is given below
function sabih_expression_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to sabih_expression (see VARARGIN)
O1=imread('2.jpg');
imshow(O1,'parent',handles.axes1)
O2=imread('1.jpg');
imshow(O2,'parent',handles.axes2)
O3=imread('3.jpg');
imshow(O3,'parent',handles.axes3)
O4=imread('Q1.png');
imshow(O4,'parent',handles.axes4)
and when I use axis 4 to show my output image in push button (that is used to browse images whose expression is to be determined) it provide error mentioned above.
my push button axes code part is given below.
function PB_input_Callback(hObject, eventdata, handles)
if (A>=6)
disp('smile')
O5=imread('S.jpg');
imshow(O5,'Parent', handles.axes4)
elseif (B>=6)
disp('sad')
O5=imread('SAD.png');
imshow(O5,'Parent', handles.axes4)
else
disp('surprise')
O5=imread('SUR.png');
imshow(O5,'Parent', handles.axes4)
end
I want to solve this problem. I shall be very thankful if some body help me out.
Thanks
Regards Ali Ahmed

Accepted Answer

Image Analyst
Image Analyst on 5 May 2013
What is A and what is B? Also, are you sure you didn't use "clear" anywhere in your program to wipe out the handles structure? Search your code for the word "clear".
  1 Comment
Ali Ahmed
Ali Ahmed on 6 May 2013
Hi Thanks for helping me now my code works perfectly well as you mention I had used close all command that made my code error full. A, B are classes I have to identify whose code isn't provided here.. Thanks a lot once more Regards Ali Ahmed

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Programming 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!