How can I use Structures array the App Designer Properties?
49 次查看(过去 30 天)
显示 更早的评论
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260417/2020-01-08%2010_59_31-MATLAB%20R2019a%20-%20academic%20use.png)
![2020-01-08 10_59_31-MATLAB R2019a - academic use.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/260417/2020-01-08%2010_59_31-MATLAB%20R2019a%20-%20academic%20use.png)
How can I solve this problem and to continue using structures also in App Designer?
0 个评论
采纳的回答
Cris LaPierre
2020-1-8
All properties you define are added to the app structure. This is accessible and passed to all functions, callbacks, etc.
0 个评论
更多回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!