Matlab crashes when saving fig
21 次查看(过去 30 天)
显示 更早的评论
In many cases, when saving the figure, the matlab crashes. It happens several times a day. It wasn't the case before 2015 version. It's very frustrating!!!!
Can anyone help?
8 个评论
Russ Park
2016-10-24
Thank you for the corroboration.
I read, from another similar case, that certain graphics hardware required some kind of driver initialization. If this is true I'm not sure how to confirm and remediate.
回答(3 个)
Walter Roberson
2016-10-24
The cure for R2014b and later, for the case where you do not need the file to be openable with MATLAB R2014a or earlier, is
tic; savefig(gcf, '/tmp/testfig.fig', 'compact'); toc;
This will save in a fraction of a second.
2 个评论
John
2016-11-14
编辑:John
2016-11-15
3 个评论
Walter Roberson
2016-11-15
编辑:Walter Roberson
2016-11-15
What kind of object are you requesting to save as? .fig? jpg? Or do you not get far enough to be given a choice?
I just tested in R2016a on a Windows 8 system and had no problem saving to fig or jpg.
Unfortunately I do not have a Windows 7 license available so I cannot test in Windows 7.
Chad
2017-9-28
I ran into this thread and thought it was worth an update: I was struggling to understand why a figure I could see was not a figure I could save. I also was unable to file->saveas-> png, but I was able to save as a .fig. The issue was in the difference between PaperPosition and Position figure properties:
hf = figure;
paperSize=[50,50,1260,820];
printSize=[0 0 16 9];
hf.Position = paperSize;
hf.PaperPosition = printSize;
plot(1,1)
saveas(gcf, 'demo.fig')
saveas(gcf, 'demo.png')
hf = figure;
hf.PaperPosition = paperSize; %this is wrong
plot(1,1)
saveas(gcf, 'demo2.fig');
saveas(gcf, 'demo2.png'); %this line fails
If I accidentally put paperSize into PaperPosition, the function crashes. I imagine this is what a lot of the people on the thread are actually dealing with, but a large amount of data may also cause a crash.
1 个评论
Nicholas George
2022-6-15
I have the problem of seeing blue screen on saving the plot as jpg. So I tried the saveas code in the program. Now the plot got saved. Thank you Chad
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!