What are matlab.apps.AppBase objects and how do I check them?
36 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Sameer
le 11 Nov 2024 à 11:07
Modifié(e) : Sameer
le 11 Nov 2024 à 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 commentaires
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!