Can i use a class file which is created outside the app designer code window?
11 次查看(过去 30 天)
显示 更早的评论
Hello Community,
I am trying to develope a post processing tool for 2D representation of ADAS test functions simulated in Simulink.
Is it possible to get the class files from outside the code block window in app designer or is it advisable to define the classes in the app designer itself.
and for the app to process data and display a 2D video. is it absolutely necessary to put all the required data's inside a single object for appdesigner to access matlab workspace and utilize it for the post processing.
Kindly let me know if my questions are clear. if it is not clear i will try to explain briefly in comments if required.
0 个评论
回答(1 个)
Eric Delgado
2024-2-18
Hey... notice that the AppDesigner code you're editing is a class. And then, you can't define a class directly within the code of another one.
Another point: it's important that you try to separate the front-end from the back-end, so it might be important for you to create classes outside of AppDesigner - using classdef - and create instances of it inside the app. To not lose the reference, you create a property in AppDesigner and store a handle to your object.
Finnaly, an app has its own workspace - its properties! If you're reading an external file to then do post-processing and plots, I suggest you store everything in the app's properties. If this is the case, you can open external file directily your app, using uigetfiles and related functions (readtable, fileread and so on).
% Outside AppDesigner (save as .m file)
classdef myClass
properties
classProperty
end
end
% Inside AppDesigner (.mlapp file)
properties (Access = private)
myObj = myClass
end
1 个评论
另请参阅
类别
在 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!