RunMat
GitHub

cla — Clear the current axes in MATLAB and RunMat plotting.

cla clears only the active axes, leaving the rest of the figure unchanged. This matches MATLAB behavior for subplot and multi-axes workflows.

Syntax

ok = cla()

Returns

NameTypeDescription
okLogicalArrayTrue when current axes are cleared.

How cla works

  • cla() clears the active axes.
  • The current subplot selection determines which axes are cleared.
  • Other axes in the same figure are left untouched.
  • cla resets the line-style cycle for the cleared axes so subsequent plots start from the default style sequence again.

Does RunMat run cla on the GPU?

cla performs no provider dispatch; it clears the active axes from the plotting registry and renderer state.

GPU memory and residency

cla only mutates plotting state and does not affect array residency.

Examples

Clear only the active subplot

subplot(1, 2, 1);
plot(1:5, 1:5);
subplot(1, 2, 2);
plot(1:5, [5 4 3 2 1]);
cla();

Expected output:

% only the second subplot is cleared

Clear the current axes and plot again

plot(1:5, 1:5);
cla();
plot(1:5, [1 2 3 4 5]);

Expected output:

% the second plot starts on an empty axes

Using cla with coding agents

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

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

FAQ

How is cla different from clf?

cla clears only the current axes, while clf clears the entire current figure.

Does cla affect other subplots?

No. It clears only the active axes.

Does cla run on the GPU?

No. It only mutates host-side plotting state.

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

clf · figure · fill3 · hold · patch · print · suptitle · xline · yline

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how cla 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.