savefig — Save one or more figures as RunMat FIG files.

savefig writes RunMat FIG files that can be reopened by openfig and hgload.

Syntax

ok = savefig(filename)
ok = savefig(fig, filename)
ok = savefig(fig, filename, version)

Inputs

NameTypeRequiredDefaultDescription
argsAnyVariadicMATLAB-compatible figure persistence arguments.

Returns

NameTypeDescription
okLogicalArrayTrue when the save operation completed.

Errors

IdentifierWhenMessage
RunMat:figurePersistence:InvalidArgumentArguments are missing, malformed, or incompatible with the requested figure persistence operation.figure persistence: invalid argument
RunMat:figurePersistence:UnsupportedFormatThe requested save/load format is recognized but not supported by RunMat's active plotting exporter.figure persistence: unsupported format
RunMat:figurePersistence:IoFailureThe target file cannot be read, written, flushed, synced, or atomically replaced.figure persistence: file I/O failed

How savefig works

  • savefig(filename) saves the current figure and appends .fig when no extension is present.
  • savefig(fig, filename) accepts a scalar figure handle or an array of figure handles.
  • savefig(fig, filename, version) accepts MATLAB version tokens -v6, -v7, -v7.3, and compact as compatibility options for the RunMat FIG scene format.
  • Non-.fig extensions are rejected for savefig.

Does RunMat run savefig on the GPU?

No numeric GPU kernel is launched.

The figure scene exporter preserves existing plotting state without routing through scalar plotting loops.

GPU memory and residency

savefig writes host or virtual-filesystem bytes and returns a host logical status.

Example

Save and reopen the current figure

plot(1:4, [1 3 2 4]);
savefig("session_plot.fig");
fig = openfig("session_plot.fig");

Using savefig with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how savefig changes the result.

Run a small savefig example, explain the result, then change one input and compare the output.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how savefig is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 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.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.