Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

hgsave - Save Handle Graphics object hierarchy to file

GUI Alternative

Use the File —> Saveas on the figure window menu to access the Export Setup GUI. For details, see How to Print or Export in the MATLAB Graphics documentation.

Syntax

hgsave('filename')
hgsave(h,'filename')
hgsave(...,'all')
hgsave(...,'-v6')
hgsave(...,'-v7.3')

Description

hgsave('filename') saves the current figure to a file named filename.

hgsave(h,'filename') saves the objects identified by the array of handles h to a file named filename. If you do not specify an extension for filename, then the extension .fig is appended. If h is a vector, none of the handles in h may be ancestors or descendents of any other handles in h.

hgsave(...,'all') overrides the default behavior, which does not save nonserializable objects. Nonserializable objects include the default toolbars and default menus. This allows revisions of the default menus and toolbars to occur without affecting existing FIG-files and also reduces the size of FIG-files. Passing the string all to hgsave ensures that nonserializable objects are also saved.

Note: the default behavior of hgload is to ignore nonserializable objects in the file at load time. This behavior can be overwritten using the all argument with hgload.

hgsave(...,'-v6') saves the FIG-file in a format that can be loaded by versions prior to MATLAB 7.

hgsave(...,'-v7.3') saves the FIG-file in a format that can be loaded only by MATLAB versions 7.3 and above. This format, based on HDF5 files, is intended for saving FIG-files larger than 2 GB.

You can make -v6 or -v7.3 your default format for saving MAT-files and FIG-files by setting a preference, which will eliminate the need to specify the flag each time you save. See MAT-Files Preferences in the MATLAB Desktop Tools and Development Environment documentation.

Full Backward Compatibility

When creating a figure you want to save and use in a MATLAB version prior to MATLAB 7, use the 'v6' option with the plotting function and the '-v6' option for hgsave. Check the reference page for the plotting function you are using for more information.

See Plot Objects and Backward Compatibility for more information.

See Also

hgload, open, save

Figure Windows for related functions

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS