Open figure saved in FIG-file
the figure saved in the MATLAB® figure file (FIG-file) called
Security Considerations: The
openfig function might execute code contained
in a FIG-file as it loads the graphics objects. Avoid calling
openfig on untrusted FIG-files.
whether to open a new copy of the figure in the case that a copy is
already open. If you do not want to create a new copy, set
'reuse' option brings the existing figure to
the front of the screen. To open a new copy of the figure regardless
of whether a copy is already open, set
'new' option is the default behavior.
whether to open the figure in a visible or invisible state. To display
the figure, set
If you do not want to display the figure, use the
You can use this option with any of the input argument combinations
in the previous syntaxes.
Open Figure Saved in MATLAB Figure File
Create a surface plot and save the figure as a MATLAB figure file. Then, close the figure.
surf(peaks) savefig('MySavedPlot.fig') close(gcf)
Open the saved figure.
Open Invisible Figure in Visible State
Create a surface plot and make the figure invisible. Then, save the figure as a MATLAB figure file. Close the invisible figure.
surf(peaks) set(gcf,'Visible','off') savefig('MySavedPlot.fig') close(gcf)
Open the saved figure and make it visible on the screen.
filename — File name of saved figure
character vector | string
File name of saved figure, specified as a character vector or string. You do not have to
specify the full file path, as long as it is on your MATLAB path. Including
.fig in the file name is
copies — Control for opening multiple copies of figure
'new' (default) |
Control for opening multiple copies of the figure, specified as one of these values:
'new'— Open a new copy of the figure, even if a copy already exists on the screen.
'reuse'— Open a new copy of the figure only if one does not exist. If a copy exists, then bring the existing copy to the front of the screen. If the figure is off the screen, then
'reuse'repositions the figure so that it is completely on the screen. This option helps provide compatibility with different screen sizes and resolutions by ensuring that the figure displays on screen.
visibility — Figure visibility
Figure visibility, specified as one of these values:
'visible'— Open the saved figure in a visible state. If the MATLAB figure file contains an invisible figure, then you can use this option to make the figure visible when it opens.
'invisible'— Open the saved figure in an invisible state.
Do not use
openfigto open FIG-files created with GUIDE. Use the
Introduced before R2006a