How to get user input from edit field (numeric)

9 ビュー (過去 30 日間)
dan bloodworth
dan bloodworth 2021 年 3 月 14 日
編集済み: dan bloodworth 2021 年 3 月 14 日
I'm trying to get the values from an edit field in order to do some manipulation.
x1 = get(app.EditField1, 'String');
x2 = get(app.EditField2, 'String');
y1 = str2double(x1)*Fs;
y2 = str2double(x2)*Fs;
However, for some reason I get the following error.
Error using matlab.ui.control.NumericEditField/get
Unrecognized property String for class NumericEditField.
I'm not sure why this is, I've tried various different ways from various posts on here but I'm having no luck. Any help would be appreciated.
EDIT: I've also tried returning types such as 'int' and 'string'. Additionally I've tried:
app.EditField1.Value
  2 件のコメント
Mario Malic
Mario Malic 2021 年 3 月 14 日
app.EditField1.Value should work, you don't have to use str2num.
dan bloodworth
dan bloodworth 2021 年 3 月 14 日
編集済み: dan bloodworth 2021 年 3 月 14 日
When using app.EditField1.Value, I get the following error:
Error using handle.handle/get
Invalid or deleted object.
I'm certain that i'm referencing the correct name of the edit field.
EDIT: I've got it working, I was still using get() by accident. Thanks for your help

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by