openfig
Opens a figure that was saved in a .fig file.
Category: Graphics > Printing and Saving
Syntax
fig = openfig(filename)
Opens the figure stored in filename and returns its handle.
fig = openfig(filename, visibility)
Opens the figure with the given visibility, such as 'invisible'.
Description
openfig rebuilds a figure from a .fig file written by savefig. All the objects come back with their properties, so they can be found with findobj and changed like those of any other figure.
If the file does not exist, an error reports that the file or folder could not be found.
Input arguments
filename- Name of the
.figfile, as text. The extension may be left out. visibility'visible'or'invisible'. Use'invisible'to load a figure without showing a window.
Output arguments
fig- Handle of the restored figure.
Example
Recover the data of a saved figure
f = figure('Visible', 'off');
plot([3 1 2]);
savefig(f, 'demo');
g = openfig('demo', 'invisible');
l = findobj(g, 'Type', 'line');
disp(get(l, 'YData'))
Output
3 1 2