"Marco" <MATLABnewsgroup@mobildata.de> wrote in message <firstname.lastname@example.org>... > "Erik" wrote in message <email@example.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.