Retrieve an attribute from matlab to app designer

1 回表示 (過去 30 日間)
Lucas S
Lucas S 2019 年 5 月 9 日
Hello !
I have a matlab script with some attributes and an App designer script.
I would like to know if it is possible to use or to retrieve an attribute of the matlab script with the appdesigner script.
My goal is to compare an attribute's value with 0 and launch the script or not ?
Thanks for helping !

回答 (1 件)

Stephane Dauvillier
Stephane Dauvillier 2019 年 5 月 9 日
There is several ways to do what you want to do. It will depend on your MATLAB knwoledge.
To answer you first question. You can access a property of any object (not only an app) if this property is a Public one (you can access Private property only in the method of that class).
I don't know your app so if several cause can set your proeprties to 0, I suggest you use events (advance MATLAB behavior but very powerfull).
If ther eis only one location in your app where this property is set to 0 then just call your script in your app after verifying the attribute is equal to 0
  2 件のコメント
Lucas S
Lucas S 2019 年 5 月 9 日
ok thanks ! The only way that my attribute is equal to 0 is if the user chose a wrong file (i am parsing xml file and so if it's not an XML format my attribute will be equal to 0)
in my matlab script i have
n_component = numel( component_list );
so to use it in app designer i can do
if n_component == 0
do something
end
as both file are in the same workspace or i have to do
if parsingXML().n_component == 0
do something
end
? (parsingXML is my matlab script)
Stephane Dauvillier
Stephane Dauvillier 2019 年 5 月 9 日
I don't know what parsingXML() is.
If your first answer works, use it

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by