hgsave
Saves a graphics object hierarchy, usually a figure, to a .fig file.
Category: Graphics > Printing and Saving
Syntax
hgsave(h, filename)
Saves the object h and its children to filename.
Description
hgsave is the older counterpart of savefig: it writes the objects under h to a .fig file, which hgload or openfig can read back. For new code, savefig is the usual choice.
Input arguments
h- Handle of the figure, or other graphics object, to save.
filename- Name of the file, as text. The
.figextension is added when it is missing.
Example
Save and reload a bar chart
h = figure('Visible', 'off');
bar([4 8 15]);
hgsave(h, 'bars');
k = hgload('bars');
disp(class(k))
Output
matlab.ui.Figure