How can I use Structures array the App Designer Properties?

29 ビュー (過去 30 日間)
Davide Mastrodicasa
Davide Mastrodicasa 2020 年 1 月 8 日
編集済み: mansour torabi 2021 年 10 月 1 日
I have a problem using structures in the App Designer properties. I'm new on App Designer and I would like to have some common variables to all the callback functions. In the original script that I'm using, these variables where ordinated in a structure but I'm not able to do the same in the App Designer. The error it is relative to the use of the dot when I write a structure array.2020-01-08 10_59_31-MATLAB R2019a - academic use.png
How can I solve this problem and to continue using structures also in App Designer?

採用された回答

Cris LaPierre
Cris LaPierre 2020 年 1 月 8 日
Use the Properties option in App Designer.
All properties you define are added to the app structure. This is accessible and passed to all functions, callbacks, etc.

その他の回答 (1 件)

mansour torabi
mansour torabi 2021 年 10 月 1 日
編集済み: mansour torabi 2021 年 10 月 1 日
To define a structure variable as a public Propertey in the App Designer, use struct function:
properties (Access = public)
YourPublicVariable = struct('FieldName1',Value1,'FieldName2',Value2);
end
Then anywehere in the App designer code, your defined variable can be accessed using app variable:
function SomeOtherFunction(app)
YourValue1 = app.YourPublicVariable.FieldName1;
end

カテゴリ

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