필터 지우기
필터 지우기

How do I solve the error: Undefined variable "handles" or class "handles.edit21"?

조회 수: 2 (최근 30일)
I have developed a GUI.When the pushbuttton is clicked, the calculation is done and the calculated number which is stored in the variable 'T' must be displayed in an edit box as the output. I have used
set(handles.edit21,'String',T);
in the pushbutton callback. However when i click the pushbutton, I get the following error:
Undefined variable "handles" or class "handles.edit21".
How can I rectify this?

답변 (3개)

Muruganandham Subramanian
Muruganandham Subramanian 2012년 12월 18일
편집: Muruganandham Subramanian 2012년 12월 18일
Variable 'T' should be converted to string using num2str(T) first, before calling. Have you done this?

Jan
Jan 2012년 12월 18일
Whne the variable handles is unknown, you have to define it. This is actually trivial, so I'm not sure what the problem exactly is. A guess:
handles = guidata(hObject);
  댓글 수: 1
Nitin Samuel
Nitin Samuel 2012년 12월 18일
Actually Im new to matlab so dont knw much...In the beginning you have :
handles = guihandles(fig);
guidata(fig, handles);
I tried adding in hObject with 'fig' & 'handles', it says
Undefined function or variable 'hObject'.
Where should I put it? Really appreciate your help..

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


Ilham Hardy
Ilham Hardy 2012년 12월 18일
Did you use any clear -command family in your GUIDE code?
Such as:
clear
clearvars
clear all

카테고리

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