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

g. a.
g. a. 2017년 1월 8일
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