RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • addpoints
    • ancestor
    • animatedline
    • area
    • axes
    • axis
    • bar
    • barh
    • box
    • caxis
    • cla
    • clf
    • clim
    • colorbar
    • colorcube
    • colormap
    • colororder
    • contour
    • contour3
    • contourf
    • copyobj
    • daspect
    • datacursormode
    • dataTipTextRow
    • errorbar
    • fcontour
    • figure
    • fill
    • fill3
    • findobj
    • fsurf
    • gca
    • gcf
    • get
    • gobjects
    • grid
    • groot
    • heatmap
    • hgload
    • hgsave
    • hidden
    • hist
    • histogram
    • histogram2
    • hold
    • image
    • imagesc
    • imshow
    • legend
    • line
    • linkaxes
    • loglog
    • mesh
    • meshc
    • openfig
    • opengl
    • pan
    • parula
    • patch
    • pie
    • plot
    • plot3
    • plotmatrix
    • plotyy
    • polarhistogram
    • polarplot
    • polarscatter
    • print
    • quiver
    • quiver3
    • ribbon
    • saveas
    • savefig
    • scatter
    • scatter3
    • semilogx
    • semilogy
    • set
    • sgtitle
    • shading
    • sphere
    • stackedplot
    • stairs
    • stem
    • subplot
    • subtitle
    • suptitle
    • surf
    • surfc
    • text
    • textscatter
    • textscatter3
    • title
    • triplot
    • view
    • waitbar
    • wordcloud
    • xlabel
    • xlim
    • xline
    • xscale
    • xtickangle
    • xtickformat
    • xticklabels
    • xticks
    • ylabel
    • ylim
    • yline
    • yscale
    • ytickangle
    • ytickformat
    • yticklabels
    • yticks
    • zlabel
    • zlim
    • zoom

clf — Clear figure contents in MATLAB and RunMat plotting.

clf clears the contents of the current figure while leaving the figure handle itself alive. It accepts explicit figure numbers, figure-number arrays, and RunMat's 'all' selector. Typed integer figure numbers are an exact structural convenience available in RunMat mode; compatibility mode accepts ordinary double figure numbers.

Syntax

result = clf()
result = clf(targets...)

Inputs

NameTypeRequiredDefaultDescription
targetsAnyVariadic—Figure handle(s) or mode tokens ('all', 'reset').

Returns

NameTypeDescription
resultNumericScalarCleared handle for single-target calls or count for multi/all clears.

Errors

IdentifierWhenMessage
RunMat:clf:InvalidArgumentOne or more clear targets are invalid.clf: invalid argument
RunMat:clf:InternalInternal figure clear operation fails.clf: internal operation failed

How clf works

  • clf() clears the current figure.
  • clf(handle) clears the specified figure handle.
  • clf('all') is a separately gated RunMat convenience that clears every known figure and returns the number of figures that were cleared; compatibility mode rejects it before plotting-state access.
  • clf(handle1, handle2, ...) is a separately gated RunMat convenience that clears multiple figures and returns the number cleared. Compatibility syntax uses one figure object or figure array.
  • clf('reset') is currently treated the same as plain clf.
  • In RunMat mode, scalar and array figure numbers can use any of the eight integer classes. Values are read from authoritative integer storage and must be positive and no larger than uint32's maximum.
  • Typed integer figure numbers are rejected in compatibility mode because the public compatibility contract documents figure numbers but does not advertise integer classes. GPU-resident numeric targets are rejected without provider dispatch.

Does RunMat run clf on the GPU?

clf performs no provider dispatch; it clears figures from the plotting registry and renderer state.

GPU memory and residency

clf only mutates host plotting state. Figure-number controls must be host values; resident numeric targets are rejected without gathering.

Examples

Clear the current figure after plotting

figure(1);
plot(1:5, [1 4 2 5 3]);
out = clf()

Expected output:

% out is the cleared figure handle

Clear a specific figure by handle

figure(3);
plot(1:5, 1:5);
out = clf(3)

Expected output:

out = 3

Clear every figure

figure(1); plot(1:5, 1:5);
figure(2); plot(1:5, [5 4 3 2 1]);
count = clf("all")

Expected output:

count = 2

Using clf with coding agents

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

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

FAQ

Does clf delete the figure handle itself?⌄

No. It clears the figure contents but keeps the figure handle selected and available.

What does clf('reset') do today?⌄

RunMat parses the keyword for compatibility, but the current implementation treats it the same as plain clf.

What does clf('all') return?⌄

It returns the number of figures that were cleared. When no figures exist, it returns 0.

Can figure numbers use integer classes?⌄

Yes in RunMat mode. int8, int16, int32, int64, uint8, uint16, uint32, and uint64 are exact structural selectors, subject to the positive uint32 figure-number range. Compatibility mode requires an ordinary double figure number.

Related Plotting functions

2D Charts

area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem

3D & Surface

contour · contour3 · contourf · mesh · meshc · plot3 · quiver · scatter3 · surf · surfc

Images

image · imagesc · imshow

Axes & Layout

axis · box · grid · sgtitle · subplot · title · view · zlabel

Appearance

colorbar · colormap · legend · shading

Handle Access

gca · gcf · get · set

Other

addpoints · ancestor · animatedline · axes · barh · caxis · cla · clim · colorcube · colororder · copyobj · daspect · datacursormode · dataTipTextRow · fcontour · figure · fill · fill3 · findobj · fsurf · gobjects · groot · hgload · hgsave · hidden · histogram2 · hold · line · linkaxes · openfig · opengl · pan · parula · patch · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · stackedplot · subtitle · suptitle · text · textscatter · textscatter3 · triplot · waitbar · wordcloud · xlabel · xlim · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · ylabel · ylim · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom

Open-source implementation

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

  • View the source for clf in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

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.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How clf works
  • Does RunMat run clf on the GPU?
  • GPU memory and residency
  • Examples
  • Clear the current figure after plotting
  • Clear a specific figure by handle
  • Clear every figure
  • Using clf with coding agents
  • FAQ
  • Related Plotting functions
  • 2D Charts
  • 3D & Surface
  • Images
  • Axes & Layout
  • Appearance
  • Handle Access
  • Other
  • Open-source implementation
  • About RunMat