Documentation Center

  • Trial Software
  • Product Updates

hgload

Load Handle Graphics object hierarchy from file

Syntax

h = hgload('filename')
[h,old_prop_values] = hgload(...,property_structure)
hgload(...,'all')

Description

h = hgload('filename') loads Handle Graphics® objects and its children (if any) from the FIG-file specified by filename and returns handles to the top-level objects. If filename contains no extension, then the MATLAB® software adds the .fig extension.

[h,old_prop_values] = hgload(...,property_structure) overrides the properties on the top-level objects stored in the FIG-file with the values in property_structure, and returns their previous values in old_prop_values.

property_structure must be a structure having field names that correspond to property names and values that are the new property values.

old_prop_values is a cell array equal in length to h, containing the old values of the overridden properties for each object. Each cell contains a structure having field names that are property names, each of which contains the original value of each property that has been changed. Any property specified in property_structure that is not a property of a top-level object in the FIG-file is not included in old_prop_values.

hgload(...,'all') overrides the default behavior, which does not reload nonserializable objects saved in the file. These objects include the default toolbars and default menus. This option is obsolete and will be removed in a future release.

Nonserializable objects (such as the default toolbars and the default menus) are normally not reloaded because they are loaded from different files at figure creation time. This allows revisions of the default menus and toolbars to occur without affecting existing FIG-files. Passing the string all to hgload ensures that any nonserializable objects contained in the file are also reloaded.

Note that, by default, hgsave excludes nonserializable objects from the FIG-file unless you use the all flag.

Alternatives

Use the File > Open on the figure window menu to access figure files with the Open dialog.

See Also

|

Was this topic helpful?