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

조회 수: 9 (최근 30일)
Ram Prasanth
Ram Prasanth 2024년 2월 15일
댓글: Ram Prasanth 2024년 2월 19일
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.

답변 (1개)

Eric Delgado
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

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by