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

3 Ansichten (letzte 30 Tage)
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 ;

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Jul. 2020
app.EditField.Value = double(x3) ;

Weitere Antworten (1)

Ibrahima Ba
Ibrahima Ba am 2 Sep. 2021
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 Kommentare
Walter Roberson
Walter Roberson am 2 Sep. 2021
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 am 3 Sep. 2021
Je vous remercie cela me sembler évident en plus .
çà marche parfaitement.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by