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
| Name | Type | Description |
|---|---|---|
ok | LogicalArray | True 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.
claresets 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 clearedClear 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 axesUsing 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.
Related Plotting functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how cla is executed, line by line, in Rust.
- View the source for cla 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.