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

51 vues (au cours des 30 derniers jours)
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 ;

Réponse acceptée

Walter Roberson
Walter Roberson le 6 Juil 2020
app.EditField.Value = double(x3) ;

Plus de réponses (1)

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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by