The Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: save figures without displaying
Replies: 28   Last Post: Feb 24, 2015 4:36 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Yuri Geshelin

Posts: 153
Registered: 10/15/07
Re: save figures without displaying
Posted: Jan 31, 2015 8:53 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Marco" <MATLABnewsgroup@mobildata.de> wrote in message <mag3v1$9oi$1@newscl01ah.mathworks.com>...
> "Erik" wrote in message <mafqu6$h60$1@newscl01ah.mathworks.com>...
> > This is a new solution based on the solution by Jesse Hopkins in post 15.
> > Windows8x64 - MATLAB R2014b:
> > using set(gcf,'CreateFcn','set(gcf,''Visible'',''on'')')
> > on an invisible figure, then you save it as a .fig file, makes the figure become visible after you open the .fig file from your explorer.

>
> Just found the thread, running today into excactly the same problem. It works! Isn't it luck for for me, that Erik published his post with updated information for R2014b users right this morning?! Thanks so much!


Confirmed: 'CreateFcn' doesn't work in MATLAB R2014b either. So unless Eric and Marco post the set of commands they used, I will assume that they are mistaken.

If, however, 'CreateFcn' is replaced with 'ResizeFcn' then the set of commands I posted in message #23 is working. But this is precisely what Jesse Hopkins had proposed on 1 Nov, 2013 (message 15), and it is a great solution. However, Joe reported a strange effect in the case when a figure has subplots and a lot of re-positioning and modifications (message 18). I double-checked: indeed, with complex .FIG files some subtle features are not reproduced upon opening the figure.

I then tried slightly different approach (also based on ResizeFcn, thanks Jesse!) which worked well for me:

close all
plot(1:10)
set(1,'vis','off','resizefcn','g_old = gcf;set(copyobj(g_old,0),''visible'',''on''),close(g_old)')
saveas(1,'tstvis.fig')
close all
open('tstvis.fig')

Also, instead of plot(1:10), I tried this on a complex figure, and it works as well.
This approach is not suitable for big (100 Mb+) files, as it takes up a lot of memory.

P.S. Don't even try 'CreateFcn' in this context - it will crash Matlab due to a set of recursive calls to HGLOAD.



Date Subject Author
4/14/11
Read save figures without displaying
Oliver
4/14/11
Read Re: save figures without displaying
Grzegorz
4/14/11
Read Re: save figures without displaying
Oliver
4/14/11
Read Re: save figures without displaying
John
4/14/11
Read Re: save figures without displaying
Grzegorz
4/14/11
Read Re: save figures without displaying
Yuri Geshelin
4/19/11
Read Re: save figures without displaying
Oliver Woodford
4/20/11
Read Re: save figures without displaying
Yuri Geshelin
10/30/12
Read Re: save figures without displaying
Lisa Thierbach
12/13/12
Read Re: save figures without displaying
Tor Inge Birkenes
12/13/12
Read Re: save figures without displaying
Steven Lord
12/13/12
Read Re: save figures without displaying
Yuri Geshelin
12/14/12
Read Re: save figures without displaying
Tor Inge Birkenes
12/13/12
Read Re: save figures without displaying
Yuri Geshelin
11/1/13
Read Re: save figures without displaying
Julian
11/22/13
Read Re: save figures without displaying
Bo Zhang
2/11/14
Read Re: save figures without displaying
Benjamin
8/29/14
Read Re: save figures without displaying
Joe
9/2/14
Read Re: save figures without displaying
Joe
1/29/15
Read Re: save figures without displaying
Erik
1/29/15
Read Re: save figures without displaying
Yuri Geshelin
1/30/15
Read Re: save figures without displaying
Erik
1/30/15
Read Re: save figures without displaying
Yuri Geshelin
1/30/15
Read Re: save figures without displaying
Marco
1/30/15
Read Re: save figures without displaying
Yuri Geshelin
1/31/15
Read Re: save figures without displaying
Yuri Geshelin
2/2/15
Read Re: save figures without displaying
Marco
2/3/15
Read Re: save figures without displaying
Yuri Geshelin
2/24/15
Read Re: save figures without displaying
Joe

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.