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?
Try this code:
figure('Visible','off')
plot(1:100)
saveas(gcf,'file.fig','fig')
openfig('file.fig','new','visible')
best regards
Grzegorz
I think the only way is to make it so the fig is saved with visible 'on', but somehow not actually display the figure when visible is set to 'on'...
Any ideas about minimising figure windows?
But I have no idea how to save it again in fig format.
Grzegorz
I think the workaround is to set up a listener, which will monitor the children of the root and as soon as the new ones appear make them visible. Unless it contradicts with your other preferences and work style, you can add the listener to startup: it won't prevent you from setting the 'visible' property to 'off', as it will only be applied to the new figure handles that appear in the workspace.
Defining Events and Listeners:
http://www.mathworks.com/help/techdoc/matlab_oop/brb6gnc.html#top_of_page
HTH
Yuri
"Oliver" wrote in message <io6jkk$5em$1...@fred.mathworks.com>...
There is a much simpler solution than making the figures not visible. Always render into the same figure:
for a = 1:num_figs
set(0, 'CurrentFigure', 1);
clf reset;
% Plot here
% Save here, using print or export_fig
end
This avoids bringing the figure to the foreground every time it's rendered.
While seeking for a solution to my problem, I found a very easy solution to yours. It is much easier than the listener that I proposed.
A clue:
>> help open
. . . . . . . . . . . . . . . . . . . . .
OPEN is user-extensible. To open a file with the extension ".XXX",
OPEN calls the helper function OPENXXX, that is, a function
named 'OPEN', with the file extension appended.
. . . . . . . . . . . . . . . . . . . . .
The remedy:
1) Locate function OPENFIG and copy it to a directory, which is found on the path before the one, in which OPENFIG resides.
2) On the top of the code, find this line
visible = ''
(it goes after if nargin < 3)
and replace it with
visible = 'visible'
That’s it! :)
HTH
PS The solution by the other Oliver (to render all plots in the same figure) may not come in handy, because
(a) sometimes it is not easy to change the algorithm: the figure number may be a result of not trivial computation;
(b) a single figure will be seen all the time, while the objective is to get rid of all figures.