RunMat
GitHub

clc — Request that the host clear the visible Command Window or console display.

clc clears the visible console by emitting a clear-screen control event that the active host interprets. In terminal hosts this maps to an ANSI clear sequence, and in WASM hosts it is surfaced as a clear stream entry so the embedding UI can wipe its displayed output.

How clc works in RunMat

  • clc accepts no input arguments.
  • The builtin does not print text itself. Instead it records a clear-screen control event in the execution stream.
  • Terminal hosts may translate that control event into an ANSI screen clear, while WASM hosts receive it as a stream entry with stream = 'clear'.
  • clc affects the visible console display only. It does not change workspace variables, figures, or execution state.
  • Passing any input arguments raises a MATLAB-style builtin error.

How clc runs on the GPU

clc is a host-side control builtin. It emits a clear-screen event and does not perform numeric computation, array traversal, or GPU provider calls.

Examples

Clear the command window after printing a message

disp('hello');
clc;

Expected output:

% The host clears the visible console after displaying hello

Use clc between interactive steps

disp('Step 1 complete');
clc;
disp('Ready for the next command')

Expected output:

% Only the later output remains visible if the host honors clear-screen events

Calling clc with inputs is invalid

clc(1)

Expected output:

clc: expected no input arguments

FAQ

Does clc delete previous output permanently?

It requests that the active host clear the visible console. Whether historical output remains available elsewhere depends on the host application.

What does WASM receive for clc?

WASM hosts receive a stdout-like stream entry with stream = 'clear', which the embedding UI should interpret by wiping its rendered console output.

Does clc change variables or figures?

No. clc only targets the visible console. Use clear for workspace variables and close all for figures.

Can I pass arguments to clc?

No. The current implementation matches MATLAB's zero-input usage and raises an error when arguments are supplied.

Does GPU residency matter for clc?

No. clc is purely a host-side control event and never interacts with GPU providers.

These functions work well alongside clc. Each page has runnable examples you can try in the browser.

disp, clear, close

Open-source implementation

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

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.

  • Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
  • Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
  • A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.

Getting started · Benchmarks · Pricing

Try RunMat — free, no sign-up

Start running MATLAB code immediately in your browser.