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 Comment

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

Sign in to comment.

Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Products

Asked:

on 10 Jul 2013

Commented:

on 8 Jan 2017

Community Treasure Hunt

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

Start Hunting!