How to pass variables within App Designer to be saved to file

13 ビュー (過去 30 日間)
Thomas Gross
Thomas Gross 2020 年 12 月 13 日
編集済み: Mohammad Sami 2020 年 12 月 13 日
I want to create an app using app designer. I have prepared several edit fields to input the data (numerical and text). Then I also have a simple save button and I want to save all input data of the edit fields to a *.mat file. But how can i access the variables from the edit fields to be saved? I am currently not familiar with the handels structure and the way of using this - are there some examples somewhere that could help me in this regard?
  1 件のコメント
Henry Tran
Henry Tran 2020 年 12 月 13 日
Hi,
you can get the value in the Edit Field through:
test=app.EditField.Value
save('test.mat','test')

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

回答 (1 件)

Mohammad Sami
Mohammad Sami 2020 年 12 月 13 日
編集済み: Mohammad Sami 2020 年 12 月 13 日
You can access the "Value" property of the edit fields to get the associated text / numeric values.
Your code will be inside the save button callback.
if true
a = app.editfield1.Value;
b = app.editfield2.Value;
save('pathtomat.mat','a','b');
end

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT Files についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by