Displaying an integer value in a numeric edit field in App Designer

27 次查看(过去 30 天)
I am trying to make an edit field display an integer value instead of using scientific notation. I would like to do it in a Value Changed Function after the code seen here:
% Value changed function: AmbientFieldEditField
function AmbientFieldEditFieldValueChanged(app, event)
value1 = app.AmbientFieldEditField.Value;
app.Ba_mag = value1;
I have tried a few things with no success such as:
int8(round(app.AmbientFieldEditField.Value,0));
I am not sure if I am even on the right track. I will also eventually need to apply the same change to the Z-axis of a 3D plot.
The edit field:
Any help is appreciated, thanks!

采纳的回答

Cris LaPierre
Cris LaPierre 2021-2-26
This is related to the display format. In the property inspector, loof for the ValueDisplayFormat property. The default is $11.4g. Change it to %g.
You can also set this programmatically.
app.AmbientFieldEditField.ValueDisplayFormat - '%g';
  2 个评论
Joshua Mitchell
Joshua Mitchell 2021-3-1
Thank you Cris! that worked perfectly. Do you have any similar recommendations for the Z-axis of a 3D plot?
This example doesn't show the issue, but theoretically the end user could have up to 5 digits on the Z-axis and that ends up displayed in scientific notation as well, it looks like the value display format isn't a field in the axes menu:

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by