필터 지우기
필터 지우기

MATLAB GUI set handles text problem.

조회 수: 3 (최근 30일)
Nimisha
Nimisha 2016년 4월 4일
답변: Walter Roberson 2016년 4월 4일
if T==1
Disp = '1'
elseif T==2
Disp = '2'
elseif T==3
Disp = '3'
elseif T==4
Disp = '4'
elseif T==5
Disp = '5'
elseif T==6
Disp = '6'
elseif T==7
Disp = '7'
else
end
set(handles.text6,'string',Disp)
After number of elseif conditions i am writing above program. I am using GUI method. I am getting error as below.
Reference to a cleared variable handles.
Error while evaluating uicontrol Callback
How i can overcome it.! My all Disp values are Numeric only.!
  댓글 수: 4
Nimisha
Nimisha 2016년 4월 4일
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear all;clc
load Features.mat
t = a;
[P Q] = size(t);
load FeaturesData1.mat
s = testfea;
for i = 1:P
d(:,i) = dtw(s,t(i,:));
end
W = min(d);
[R T] = find(W ==d);
if T==1
Disp = '1'
elseif T==2
Disp = '2'
elseif T==3
Disp = '3'
elseif T==4
Disp = '4'
elseif T==5
Disp = '5'
elseif T==6
Disp = '6'
elseif T==7
Disp = '7'
else
end
set(handles.text6,'string',Disp)
THIS IS MY COMPLETE CALL BACK FUNCTION.
AND ERROR MESSAGE IS AS BELOW.
Reference to a cleared variable handles.
Error in HandGesture>pushbutton10_Callback (line 434)
set(handles.text6,'string',Disp)
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in HandGesture (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)HandGesture('pushbutton10_Callback',hObject,eventd ata,guidata(hObject))
Error while evaluating uicontrol Callback
Geoff Hayes
Geoff Hayes 2016년 4월 4일
Nimisha - if you always observe this error, then please put a breakpoint at the line
set(handles.text6,'string',Disp)
and then launch your GUI. Do whatever you normally would do and then press pushbutton10. Once the debugger pauses at this line, then look at the handles structure. Is it valid? Does it have a field named text6?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 4월 4일
Delete your "clear all". It is removing the content of "handles"

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by