hgload — Load graphics object hierarchies from RunMat FIG files.
hgload(filename) loads top-level graphics objects from a RunMat FIG file. The two-output form returns previous property values for overridden top-level figure properties.
Syntax
h = hgload(filename)
[h, old_prop_values] = hgload(filename, property_structure)Inputs
args- Type
Any- Required
- Variadic
- Description
- Filename and optional top-level property override structure.
Returns
h- Type
NumericArray- Description
- Imported top-level graphics handles.
old_prop_values- Type
Any- Description
- Cell array of previous top-level property values replaced by the override structure.
Returned values from hgload depend on how many outputs the caller requests.
Errors
RunMat:figurePersistence:InvalidArgument- When
- Arguments are missing, malformed, or incompatible with the requested figure persistence operation.
- Message
figure persistence: invalid argument
RunMat:figurePersistence:UnsupportedFormat- When
- The requested save/load format is recognized but not supported by RunMat's active plotting exporter.
- Message
figure persistence: unsupported format
RunMat:figurePersistence:IoFailure- When
- The target file cannot be read, written, flushed, synced, or atomically replaced.
- Message
figure persistence: file I/O failed
Forms
A missing .fig extension is appended. [h,old]=hgload(filename,property_structure) applies recognized top-level figure overrides after import. Unrecognized fields are ignored and omitted from old, matching the current documented behavior.
Execution and residency
The operation reads host or virtual-filesystem bytes and creates host plotting state. Numeric and GPU-resident arguments reject without gather; no numeric GPU kernel is launched. RunMat FIG is a RunMat scene archive rather than a claim of MATLAB FIG binary interchange.
The operation constructs a transient zero-, one-, or two-value result before committing imported figures. Invalid output cardinality or property restoration failure leaves no partially imported hierarchy.
Example
Load and override a figure name
plot(1:3);
hgsave(gcf,"named.fig");
[h,old]=hgload("named.fig",struct("Name","Loaded"));Using hgload with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how hgload changes the result.
Run a small hgload example, explain the result, then change one input and compare the output.
Related Plotting functions
2D Charts
area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem
Other
addpoints · ancestor · animatedline · autumn · axes · barh · bone · caxis · cla · clf · clim · colorcube · colororder · cool · copper · copyobj · cylinder · daspect · datacursormode · dataTipTextRow · drawnow · fcontour · figure · fill · fill3 · findobj · fsurf · gobjects · gray · groot · hgsave · hidden · histogram2 · hold · hot · inferno · isgraphics · ishandle · jet · line · lines · linkaxes · magma · openfig · opengl · pan · parula · patch · pink · plasma · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · spring · stackedplot · subtitle · summer · suptitle · text · textscatter · textscatter3 · triplot · turbo · viridis · waitbar · winter · wordcloud · xlabel · xlim · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · ylabel · ylim · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom
Source you can read
Every RunMat function's source is public. Read exactly how hgload is executed, line by line, in Rust.
- View the source for hgload in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.