Hang up when saving figure as bmp using print.

Hey everyone,
I have a data parser that creates several figures with multiple subplots. In order to keep from interupting the user while the parser is running, I have the figures' 'visible' set to 'off'.
I also use print() to save these figures as a bmp instead of saveas() because saveas() causes a window to briefly pop up while the code is running.
I made a very short and simple script to test my code which works but inside my parser MatLab hangs up as soon as it hits the print() command. It stays 'busy' next to the Start button.
Below is an example of my code (R2011b):
figure('visible','off'); %turn off visibility to prevent figure pop-up
h=figure;
i=1;
while i:4 %make the figure
A=rand(10,1);
B=rand(10,1);
subplot(2,2,i);
scatter(A,B);
i=i+1;
end
print(gcf,'-dbmp','randplot_test'); %save the figure
set(gcf,'visible','on'); %shows the figure to verify that the plots worked
This code shows that I'm using the print() command correctly so I'm not sure what's going wrong. Does anybody know how to fix this or at the very least know another way to save the figure while preventing windows from popping up?
Thanks, Eric

1 个评论

Hello, I have a similar problem (https://ubuntuforums.org/showthread.php?t=2348871) but your code does not hangs up my matlab.
best g.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

产品

提问:

2013-7-10

评论:

2017-1-8

Community Treasure Hunt

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

Start Hunting!

Translated by