Clear Filters
Clear Filters

Can i use a class file which is created outside the app designer code window?

9 views (last 30 days)
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.

Answers (1)

Eric Delgado
Eric Delgado on 18 Feb 2024
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

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!