"Benjamin Avants" wrote in message <email@example.com>... > "Oliver" wrote in message <firstname.lastname@example.org>... > > Hi all, I've looked around for ages but cannot find a different solution. I fear there isn't one. > > > > Problem: I have a tool that batch processes data and creates loads (00's) of figures. I don't want them flashing up and getting in the way while the user is still trying to work on the machine. > > > > Current solution: > > set(fig, 'visible','off') > > saveas(fig,'file.fig','fig') > > close(fig) > > > > This is fine, however when trying to open the saved .fig file they remain invisible. > > > > I tried.... > > set(fig, 'visible','off') > > saveas(fig,'file.fig','fig') > > set(fig, 'visible','on') > > close(fig) > > > > In the hope it wouldn't be displayed, but it is. > > > > Next idea is to open the .fig using fopen and edit the file manually to set visibility to on, then re-save the edited .fig, but the data format is unknown. > > > > Any ideas how to save invisible figures, but have them open as visible? > > Jesse, you're solution is my favorite so far and I will be using it moving forward, but I have another for people who don't want to mess with the ResizeFcn. > > On my system, if I create the figure with visible off: > > fh = figure(...,'Visible','off'); > > then build the content while the figure is invisible, I can then do the following: > > set(fh,'Visible','on'); > saveas(fh,'name','fig'); > delete(fh); > > This results in the figure being saved with visible enabled but the figure never shows up on my screen or takes focus away from whatever else I'm working on. I imagine this is because the figure is deleted before it can be fully rendered so it might not work on slower systems or when MATLAB is running multiple things simultaneously. > > If you're comfortable with setting/editing the ResizeFcn, that's a more robust solution.
I had one thing that didn't work though. One of my figures had subplots in it with a lot of re-positioning and modifications. This figure followed the code (did not pop open and saved correctly, but when I tried to double click it in the windows folder, it did not open.