read a variable in an app designer interface from a Matlab script

5 ビュー (過去 30 日間)
Bastien Binz
Bastien Binz 2021 年 6 月 30 日
コメント済み: Bastien Binz 2021 年 6 月 30 日
Good morning,
I have a question about app designer. I would like make an interface that launches my Matlab script and that this script reads the values of two parameters. I have declared these two variables (A and B for example) in properties in public acces. I use a spinner to define the value of A and B.
In the Spinner function I update the variable this way :
app.A = app.ASpinner.Value;
In my MATLAB script I wanted to use this value for different equations. So I called it that way :
Interface.A; Where Interface is the name of my app designer project.
But I have this error :
ActiveX - invalid PROGID 'A'; Error Code = 800401F3
I instantiated these two variables with a value in the startupFcn function.
So my question is whether it's possible to have a variable coming from an app designer interface in a matlab script.
I can go through a .mat file for this but is ther a more direct method?
Thanks in advance for your help, have a nice day.

採用された回答

Mohammad Sami
Mohammad Sami 2021 年 6 月 30 日
If you want to be able to access your app inside the script, first create and assign your app to a variable, then you can access its properties.
Example
app = Interface; % this will launch your app.
A = app.A; % now you can get its properties.
  1 件のコメント
Bastien Binz
Bastien Binz 2021 年 6 月 30 日
Thank you for your reply. It works now.

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

その他の回答 (0 件)

カテゴリ

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