フィルターのクリア

How do I save and load an app session?

16 ビュー (過去 30 日間)
Par
Par 2020 年 2 月 28 日
回答済み: Anmol Dhiman 2020 年 3 月 6 日
I have made an app in Appdesigner, and would like to save the session and load it at a later time. I tryed to save the app object, close the application, open the application and load the app object. That resultet in multiple app sessions. I have also saved the fields of the app object to a struct with a different name. That generated the following warnings:
-Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
-Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
The process was later reversed to obtain the saved fields to the app object (the code is shown below). That resultet in the following warnings:
-Warning: While loading an object of class 'My_app': Unable to load App Designer app object. Load not supported for matlab.apps.AppBase objects.
Is it really not possible to save/load app objects?
function SavemetadataMenuSelected(app, event)
[file,path] = uiputfile('*.mat', 'Store calibration:','init_raw.mat');
fields = fieldnames(app);
data = struct;
for i = 1:numel(fields)
data.(fields{i}) = app.(fields{i});
end
data = rmfield(data,'UIFigure');
try
save(fullfile(path,file),'data')
catch ME
warning('Warning during saving: %s %s', ME.identifier, ME.message)
end
end
% Menu selected function: LoadmetadataMenu
function LoadmetadataMenuSelected(app, event)
uiopen('init_raw.mat')
fields = fieldnames(data);
for i = 1:numel(fields)
app.(fields{i}) = data.(fields{i});
end
show_img(app);
plot_calibration(app);
end

回答 (1 件)

Anmol Dhiman
Anmol Dhiman 2020 年 3 月 6 日

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by