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 Comments

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.
Ameer, thank you very much for sample app. It helped me to narrow-down the issue.

Sign in to comment.

 Accepted Answer

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.

Categories

Find more on Functions in Help Center and File Exchange

Products

Release

R2020b

Asked:

on 27 Sep 2020

Edited:

on 27 Sep 2020

Community Treasure Hunt

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

Start Hunting!