Empty windows in EditFields of app.designer?

18 ビュー (過去 30 日間)
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras 2021 年 1 月 20 日
回答済み: Juan Andrés Martin 2023 年 8 月 3 日
I'm designing an app in which you select some input variables and its values, and after clicking the button calculate, the apps calculates and shows to the some physical values that has calcuates. (e.g: ypu enter as inputs m,g,h,a (and its values) and after clicking "calculate" it shows you F (force) and ME(mechanical energy) and their values.
So, here is are the dropemenus where the user can select the inputs he wants to enter and at the right, their values.
The issue here is that, by default, those white EditField(Numeric) windows (on the right), has the 0 value on it, as you can see above. The issue is that I would like those windows to be empty until the user enters one value. Is this possible? I have tried clicking on each windows's Inspector panel as you can see below and changing its value 0 by just deleting it
But appears me this error.
So. It's possible to have those windows empty until the user enters a value? Or is any alternative way of achieving that?
Thank you very much

採用された回答

Mischa Kim
Mischa Kim 2021 年 1 月 20 日
ErikJon, as a workaround you could use an Edit Field (Text) instead of Edit Field (Numeric). The drawback of this workaround is that you need to convert the inputs from text to numeric (e.g. str2num).
  3 件のコメント
Mischa Kim
Mischa Kim 2021 年 1 月 20 日
The best place to do this, I guess, depends on what you are trying to do. However, in general, doing the conversion in this callback makes good sense. One thing that may be helpful is to save the value as a property, either private or public. See the doc for more info. This makes the variable globally accessible and you can access this variable as
app.value
You should probably pick a more suitable name for the variable though.
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras 2021 年 1 月 20 日
They were akready private property values.
And thanks for the help! It worked very well

サインインしてコメントする。

その他の回答 (1 件)

Juan Andrés Martin
Juan Andrés Martin 2023 年 8 月 3 日
Actually, you can: you just need to set the "AllowEmpty" property to "On" and then set de "Value" property to "[]"
Example:
% Create MinTipThickness2Input
app.MinTipThickness2Input = uieditfield(app.GridGearInputs, 'numeric');
app.MinTipThickness2Input.Tag = 'MinTipThickness2Input';
app.MinTipThickness2Input.AllowEmpty = 'On';
app.MinTipThickness2Input.Value = [];

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by