Error when I reset my interface ?

I have clear button that reset all interface component so I can start new operation without needing to close and open the interface here is the clear button code
set(handles.impsnr,'String','');
arrayfun(@cla,findall(0,'type','axes'))
the error is
Error in wmark_e>inp_Callback (line 137)
set(handles.msg,'Enable','on')
Because I make all Enabled button is OFF Except the first button then when the user click the first button the second button will be changed to on and so on whenever I click on clear button to start new operation the previous error appears could any one help ?

9 Kommentare

Walter Roberson
Walter Roberson am 6 Dez. 2017
Please show the complete error message, everything in red.
Eliza
Eliza am 6 Dez. 2017
here is the full code include the error
img=imread([path,fname]);
[x y dim]=size(img);
if length(size(img))>2
if dim==4
img(:,:,4) = [];
end
img=rgb2gray(img);
end
axes(handles.iim); imshow(img);
title('Orignal Image')
handles.img=img;
set(handles.msg,'Enable','on')
Eliza
Eliza am 6 Dez. 2017
here is the error message
Error using set
Invalid handle
Error in wmark_e>inp_Callback (line 137)
set(handles.msg,'Enable','on')
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in wmark_e (line 43)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)wmark_e('inp_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
Whatever handles.msg is at that point is not the handle to a graphics object. At the command line command
dbstop if error
and run your code. When it stops, examine to see what handles.msg is.
Eliza
Eliza am 6 Dez. 2017
set(handles.msg,'Enable','on')
Eliza
Eliza am 6 Dez. 2017
this is the exact error .This code aims to enable the next button .Because I make it disabled as default
Please show the output of
class(handles.msg)
Eliza
Eliza am 7 Dez. 2017
ans =
uint8
Eliza
Eliza am 7 Dez. 2017
I just have an idea to solve this problem by putting if condition to ensure this line of command will not be executed except if the default state of the button is off but there is an error also
if handles.msg.Enable=='off'

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Entering Commands finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 6 Dez. 2017

Kommentiert:

am 7 Dez. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by