Warning to save when saving workspace.
조회 수: 10 (최근 30일)
이전 댓글 표시
For this code:
savename = sprintf('%s_%s.mat',fname1,fname2);
save(savename);
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.
댓글 수: 1
Rik
2017년 9월 13일
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
2017년 9월 13일
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.
댓글 수: 2
Rik
2017년 9월 14일
I don't understand why Mathworks enabled this in the first place. I can't come up with a valid scenario to want to do this. The closest thing I can come up with is a debugging scenario, but then you can just use breakpoints or an inline call to dbstop.
Walter Roberson
2017년 9월 14일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!