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

11 次查看(过去 30 天)
I am trying to create a matlab app converting between different temperatures however when I try to run it for some reason the error message "Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111) 'Value' must be a double scalar" comes out and I am not sure why. Please let me know if you u have any questions!

回答(2 个)

Voss
Voss 2022-5-19
编辑:Voss 2022-5-19
Try it without converting to string
app.EditField.Value = Re;
because if app.EditField is a NumericEditField, its Value is a number, not a string.
  7 个评论
Walter Roberson
Walter Roberson 2022-5-19
What were the outputs?
Note that the disp() in particular is intended to be before the assignment... though now that I think about it, it would be good to also have the same statement after the assignment.
Walter Roberson
Walter Roberson 2022-5-19
if you change the code to
size(Re)
class(Re)
disp(app.EditField.Value)
app.EditField.Value = Re;
disp(app.EditField.Value)
Then what shows up in the command window?

请先登录,再进行评论。


Patrick Schneider
Patrick Schneider 2022-5-19
The output is a numeric edit field.

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by