Skip to Main Content Skip to Search
Product Documentation

openfig - Open new copy or raise existing copy of saved figure

Syntax

openfig('filename.fig')
openfig('filename.fig','new')
openfig('filename.fig','reuse')
openfig('filename.fig','new','invisible')
openfig('filename.fig','reuse','invisible')
openfig('filename.fig','new','visible')
openfig('filename.fig','reuse','visible')
figure_handle = openfig(...)

Description

openfig('filename.fig') and openfig('filename.fig','new') opens the figure contained in the FIG-file, filename.fig, and ensures it is visible and positioned completely on screen. You do not have to specify the full path to the FIG-file as long as it is on your MATLAB path. The .fig extension is optional.

openfig('filename.fig','reuse') opens the figure contained in the FIG-file only if a copy of the figure is not currently open. Otherwise, openfig brings the existing copy forward, making sure it is still visible and completely on screen.

openfig('filename.fig','new','invisible') or openfig('filename.fig','reuse','invisible') opens the figure as in the preceding example, while forcing the figure to be invisible.

openfig('filename.fig','new','visible') or openfig('filename.fig','reuse','visible') opens the figure, while forcing the figure to be visible.

figure_handle = openfig(...) returns the handle to the figure.

Tips

openfig is designed for use with GUI figures. Use this function to:

If the FIG-file contains an invisible figure, openfig returns its handle and leaves it invisible. The caller should make the figure visible when appropriate.

Do not use openfig or double-click a FIG-file to open a GUI created with GUIDE. Instead open the GUI code file by typing its name in the command window or by right-clicking its name in the Current Folder Browser and selecting Run File. To open a GUIDE GUI, for example one called guifile.m, in an invisible state, specify the Visible property in your command:

guifile('Visible','off')

Your code should then make the figure visible at an appropriate time.

See Also

guide | guihandles | hgload | movegui | open | save

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS