Previous Value of Numeric Edit Field

14 次查看(过去 30 天)
Hi all,
Is there a quick way to reference the previous value of an App Deigner numeric edit field? This is in order to reset the value after an error dialog has been shown. Something like
app.NumericEditField.Value = app.NumericEditField.PreviousValue
would be ideal.
Many thanks.

采纳的回答

Joseph Cheng
Joseph Cheng 2020-2-16
I think thats almost what you'd want do have and store prevvalue during during successful calculation. Previousely in GUIDE and UIcontrol type construction there was a userdata field. I haven't been using appdesigner but it looks to be gone from a cursory inspection. However you can set a private/public property as a place to store the previous value upon successful computation run.
app.NumericEditField_N_PreviousValue= app.NumericEditField.Value
and
app.NumericEditField.PreviousValue= app.NumericEditField_N_PreviousValue
during an error catch.
  1 个评论
John Smith
John Smith 2020-2-17
Thanks, like you suggested, I stored the previous value in an app property.

请先登录,再进行评论。

更多回答(1 个)

Ajay Kumar
Ajay Kumar 2020-2-16
Try to save the Previous value in a temporary variable. For eg:
temp = app.NumericEditField.Value;
if error
app.NumericEditField.Value = temp;
else
app.NumericEditField.Value = newvalue;
end

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by