Error using matlab.ui.​control.in​ternal.mod​el.Abstrac​tNumericCo​mponent/se​t.Value (line 111) 'Value' must be a double scalar.

조회 수: 50 (최근 30일)
I am creating an application in Matlab where I want to display in Edit FIeld (Numeric) the solution of the below equation. The equation has two solutions and I want to keep the lowest of the two. When I try, the following error pops up "
Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111)
'Value' must be a double scalar."
x1=107.8485;
y2=-107.8485;
w=2100;
xRadius=2754.2;
yRadius=2754.2;
syms x6
eqn = (x6-x1)^2/xRadius^2 + (-w-y2)^2/(yRadius^2)-1;
S = vpasolve (eqn,x6);
x3 = round(min(S));
app.EditField.Value = x3 ;

채택된 답변

Walter Roberson
Walter Roberson 2020년 7월 6일
app.EditField.Value = double(x3) ;

추가 답변 (1개)

Ibrahima Ba
Ibrahima Ba 2021년 9월 2일
Bonjour j'ai créer une application, mais j'ai un probléme qui dit :
Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111)
'Value' must be a double scalar.
Pouvez vous m'aider ?
% Value changed function: Knob2
function Knob2ValueChanged(app, event)
value = app.Knob2.Value;
app.EditField.Value = value;
if strcmp(value,'Off')
app.EditField_2.Value = 'Off';
elseif strcmp(value,'Low')
app.EditField_2.Value = 'Low';
elseif strcmp(value,'Medium')
app.EditField_2.Value = 'Medium';
else
app.EditField_2.Value = 'High';
end
  댓글 수: 2
Walter Roberson
Walter Roberson 2021년 9월 2일
app.EditField_2 has been configured as a Numeric edit field, but you are trying to store a character vector in it. You need to change app.EditField_2 to be a text edit field.
Should it be an edit field at all? Do you want the user to be able to edit it to say (for example) 'Hello' ? When you have a limited number of permitted values and you want the user to be able to choose one of those, usually it is better to use a listbox or dropbox.
Ibrahima Ba
Ibrahima Ba 2021년 9월 3일
Je vous remercie cela me sembler évident en plus .
çà marche parfaitement.

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

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by