Error using matlab.ui.control.EditField/set.Value (line 98) 'Value' must be a character vector or a string scalar.
4 次查看(过去 30 天)
显示 更早的评论
I do simple App Designer to Circle/Sphere Calculations but I have error her
app.radius = app.EntertheradiusEditField.Value;
diameter = 2*app.radius;
[[[ app.ThediameterisEditField.Value = diameter;]]]
app.AreaEditField.Value=pi*app.radius^2;
app.CircumferenceEditField.Value =2*pi*app.radius;
app.VolumEditField.Value=(4/3)*pi*app.radius^3;
app.SurfaceEditField.Value=4*pi*app.radius^2;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/414443/image.png)
Error using matlab.ui.control.EditField/set.Value (line 98)
'Value' must be a character vector or a string scalar.
0 个评论
采纳的回答
Mario Malic
2020-11-15
编辑:Mario Malic
2020-11-15
Hello,
The component EDITED app.EntertheradiusEditField.Value is probably a Text Field, which accepts only characters/array, replace it with the numeric field component.
I would suggest you to work through the example applications in App Designer and you'll understand how things work clearly.
0 个评论
更多回答(1 个)
Image Analyst
2020-11-15
Try this:
app.ThediameterisEditField.String = num2str(diameter);
Same for the other edit fields. The contents of the edit text box are the "String" property of the control not the "Value" property.
1 个评论
Mario Malic
2020-11-15
Property Value is same for both styles of edit field component.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!