What are matlab.apps.AppBase objects and how do I check them?
조회 수: 36 (최근 30일)
이전 댓글 표시
Hello all,
I have an app with a figure that I'm saving, and despite being able to save it succesfully using saveas, I get the next warning (twice)
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
I don't really mind, but I'd rather understand the warning, someone cares to explain?
Thanks in advance!
댓글 수: 0
답변 (1개)
Sameer
2024년 11월 11일 11:07
편집: Sameer
2024년 11월 11일 11:08
Hi @Antonio
"matlab.apps.AppBase" is a class that serves as a base class for apps created using App Designer. When you create an app in App Designer, the app is essentially an object that inherits from "matlab.apps.AppBase". This class provides the necessary infrastructure for the interactive components and the overall app framework.
The warning you’re seeing, “Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects,” occurs because MATLAB does not support saving instances of App Designer apps directly. This is due to the complex nature of these objects, which include UI components and callbacks that cannot be serialized easily
To work around this, you can save the data and state of your app separately.
1. Extract the data you need from your app and save it to a ".mat" file.
2. When you reload your app, read the data from the ".mat" file and restore the state of your app.
Here’s a simple example:
% Save data
data = struct;
data.Property1 = app.Property1;
data.Property2 = app.Property2;
save('appData.mat', 'data');
% Load data
loadedData = load('appData.mat');
app.Property1 = loadedData.data.Property1;
app.Property2 = loadedData.data.Property2;
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!