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!

回答(1 个)

Sameer
Sameer 2024-11-11,11:07
编辑:Sameer 2024-11-11,11:08
"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!

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by