Executing save command in App triggers warning "Unable to save App Designer app object"

Hi guys,
As the title states, I am getting this error while trying to save propererties/variables in App Designer.
Full warning: Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects
I don't like seeing warnings, neither hiding them. So, what would be appropriate way of saving properties in .mat file from App Designer.
Looking into the document for matlab.apps.AppBase
saveobj Saving an instance of an app object is not supported.

6 commentaires

Are you trying to save all the variables inside the app? Why not just save the variables you need later. Saving the app object does not make much sense.
save('filename.mat', 'variable1_name', 'variable2_name', 'variable3_name')
I am saving properties.
Sim_Data = struct('Optim_Options', app.Optim_Options, 'User_Input_Vars', app.User_Input_Vars);
save('Simulation_Data.mat', '-struct', 'Sim_Data')
I have also tried assigning these properties to variables, and still I have the same warning.
See the attached app. I am also doing something similar, but I don't get any error when I run it on my system.
Did you forget to attach it?
Please check the updated comment.
Ameer, thank you very much for sample app. It helped me to narrow-down the issue.

Connectez-vous pour commenter.

 Réponse acceptée

It looks like, when one passes an app property into an anonymous function, one gets mentioned warning and wants to save app.x
app.x = optimoptions('fmincon', ...
'OutputFcn', @(x, optimValues,state)CustomOptimPlotFval(app.y), 'Display', 'iter-detailed');
% ^^^^
Without app it works fine.

Catégories

En savoir plus sur Functions dans Centre d'aide et File Exchange

Produits

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by