How do I create and use class constructors with app-wide scope in App Designer?
20 次查看(过去 30 天)
显示 更早的评论
I am attempting to migrate a previously hand-coded GUI app (R2017b) that includes user-defined class constructors (as distinct m-files) into App Designer (R2021a). These constructors can be called anywhere in the original GUI; does anyone know how to implement this in App Designer?
Thanks!
0 个评论
回答(1 个)
Hornett
2024-9-6
I understand that you trying to create and use class constructor in App Designer.
In your app, create a new class file in the same folder as your app file. Define a handle class by creating a ‘classdef’ block. Below is the sample code.
classdef YourClassName < handle
% ...
end
Now define properties and methods in your class. To access the data object from within App Designer, create an instance of the class in your App Designer code and store it in a property of your app.
You can refer to this documentation for more detailed explanation: https://www.mathworks.com/help/matlab/creating_guis/organize-app-data-in-complex-apps-using-matlab-classes.html
I hope this information helps in resolving your query.
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!