MATLAB Answers

Converting double to a handle

조회 수: 209(최근 30일)
DARLINGTON ETAJE
DARLINGTON ETAJE 2020년 4월 23일
댓글: Adam Danz 2020년 4월 24일
When I run the app designer, I keep getting the error
Error setting property 'EditField' of class 'Name0fGui':
Cannot convert double value 2 to a handle
Here is the code
properties (Access = private)
counter1=0 % Description
counter2=0 % Description
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: Button
function ButtonPushed(app, event)
value1=app.ChestPainCheckBox.Value;
if value1==1
app.counter1=app.counter1+1;
else
app.counter1=app.counter1;
end
value2=app.LuckyDipMaCheckBox.Value;
if value2==1
app.counter2=app.counter2+1;
else
app.counter2=app.counter2;
end
value3=app.AbrosyeCheckBox.Value;
if value3==1
app.counter1=app.counter1+1;
else
app.counter1=app.counter1;
end
value4=app.UnclemidadaCheckBox.Value;
if value4==1
app.counter2=app.counter2+1;
else
app.counter2=app.counter2;
end
app.EditField=app.counter1;
app.EditField2=app.counter2;
end
end

채택된 답변

Adam Danz
Adam Danz 2020년 4월 23일
Try
app.EditField.Value = app.counter1;
app.EditField2.Value = app.counter2;
% ^^^^^^
If that doesn't fix the problem, please provide the entire error message and point to the line that is causing the error.
  댓글 수: 4
Adam Danz
Adam Danz 2020년 4월 24일
Glad I could help!

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

추가 답변(0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by