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

52 visualizaciones (últimos 30 días)
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 ;

Respuesta aceptada

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

Más respuestas (1)

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

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by