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

48 ビュー (過去 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 Center および File ExchangeMathematics についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by