Warning to save when saving workspace.
19 views (last 30 days)
Show older comments
John on 13 Sep 2017
Commented: Walter Roberson on 14 Sep 2017
For this code:
savename = sprintf('%s_%s.mat',fname1,fname2);
It produces a warning: "Warning: Figure is saved in C:\Data\R1\R32.mat. Saving graphics handle variables can cause the creation of very large files. To save graphics figures, use savefig."
The save actually worked and saved the workspace correctly as .mat. Changed to "save savename" it had the same warning.
Why's that? It's not a fig to save.
Rik on 13 Sep 2017
It is much better practice to save specific variables to your mat-file.
Probably you had a figure handle in your workspace, which then triggers this error.
Walter Roberson on 13 Sep 2017
When you do not tell save() which variables to save then it saves everything in your current workspace, including any graphics objects whose handles are in the current workspace. It is recommended that you tell save which variables you wish to save.
Walter Roberson on 14 Sep 2017
Potentially you might have a large number of variables and need to "checkpoint" the calculation.
Or simply that you might need to log off for the day and you want to preserve your state so you can resume the next day.
More Answers (0)
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!