hgload

Loads a graphics object hierarchy saved in a .fig file.

Category: Graphics > Printing and Saving

Syntax

h = hgload(filename)

Loads the objects stored in filename and returns the handle of the figure.

Description

hgload reads a file written by hgsave or savefig and recreates its objects. It is the older counterpart of openfig. If the file cannot be found, an error is raised.

Input arguments

filename
Name of the .fig file, as text.

Output arguments

h
Handle of the loaded figure.

Example

Read back a saved figure

h = figure('Visible', 'off');
plot(1:3);
hgsave(h, 'line');
k = hgload('line');
l = findobj(k, 'Type', 'line');
disp(get(l, 'YData'))
Output
     1     2     3

See also

hgsave openfig savefig findobj