save figure in backround job

Hi,
I am running a matlab job on an external computer. Figure display is not possible. However, I would like to save figures while the job is running between. I tried the following:
(extract from the code)
for ii = 1:1:100
% ...working with Frame ...
figure('visible','off')
imshow(Frame);
print(gcf,'-dpng', ['frame' num2str(ii),'.png']);
close(figure)
end
but it doesn't work. Does anyone have an idea how to realize that? I really prefer to save the images and not to keep the data sets.
Thanks a lot in advance.
Franziska

4 commentaires

Sean de Wolski
Sean de Wolski le 3 Avr 2012
What doesn't work? Are the images not correct? Do they not appear? Does the code not run due to an error?
Franziska
Franziska le 3 Avr 2012
Hi,
I receive an error message:
"{Error using imshow (line 190)
IMSHOW unable to display image.}
The reason might be the missing graphical interface although I use invisible? The problem is not the command used to save the image.
The code works fine on my PC (without displaying the figure).
Cheers,
Franziska
Sean de Wolski
Sean de Wolski le 3 Avr 2012
Why not just IMWRITE?
Franziska
Franziska le 4 Avr 2012
Thanks for your help!
I deleted the lines creating the figure with imshow and can use imwrite or imsave right a way.

Connectez-vous pour commenter.

 Réponse acceptée

Thomas
Thomas le 3 Avr 2012

0 votes

Your code should work.. If not try..
doc imsave

2 commentaires

Franziska
Franziska le 3 Avr 2012
Thanks for your answer. The problem is not to save the figure, it's the imshow command. I receive the following error message:
"{Error using imshow (line 190)
IMSHOW unable to display image.}
The code runs fine on my PC without showing the figure.
Cheers,
Franziksa
Franziska
Franziska le 4 Avr 2012
It work's. Sorry for confusion.
If I do not create the figure but save the image directly, it's fine.
Thank's for your help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by