How do I save and load an app session?
16 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
Anmol Dhiman
2020 年 3 月 6 日
Hi Par,
You can save the objects as mentioned in the steps in below link.
Thanks
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!