clc — Clear the visible command window or console display in MATLAB and RunMat hosts.
clc clears visible console output by emitting a host clear-screen event. Terminal hosts typically translate this to ANSI clear behavior, while WASM hosts expose a clear stream event for embedding UIs.
Syntax
clc()Returns
| Name | Type | Description |
|---|---|---|
ans | NumericArray | Empty matrix placeholder returned by sink invocation. |
Errors
| Identifier | When | Message |
|---|---|---|
| — | One or more input arguments are passed to clc. | clc: expected no input arguments |
How clc works
clcaccepts 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'. clcaffects 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.
Does RunMat run clc 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 helloUse 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 eventsCalling clc with inputs is invalid
clc(1)Expected output:
clc: expected no input argumentsUsing clc with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how clc changes the result.
Run a small clc example, explain the result, then change one input and compare the output.
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.
Related Io functions
Repl Fs
addpath · cd · copyfile · delete · dir · exist · fullfile · genpath · getenv · ls · mkdir · movefile · path · pwd · rmdir · rmpath · run · savepath · setenv · tempdir · tempname · uigetfile · uiputfile
Tabular
csvread · csvwrite · detectImportOptions · dlmread · dlmwrite · readmatrix · spreadsheetImportOptions · writecell · writematrix · xlsread
Filetext
fclose · feof · fgetl · fgets · fileread · filewrite · fopen · fprintf · fread · frewind · fwrite
Import
Json
Archive
Http
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how clc is executed, line by line, in Rust.
- View the source for clc 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.