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

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact
  • License
  • Privacy

Learn

  • Docs
  • Blog
  • Benchmarks
  • RunMat vs MATLAB Online

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.

/
See all docs
Builtin Reference
    • clc
    • diary
    • disp
    • display
    • format
    • input

disp — Display values without returning output in MATLAB and RunMat.

disp prints a value to the command window/console without including the variable name. Supported value classes and formatting behavior follow MATLAB semantics.

Syntax

disp(X)

Inputs

NameTypeRequiredDefaultDescription
XAnyYes—Value to display in the Command Window.

Errors

IdentifierWhenMessage
—Too many input arguments are passed to disp.disp: too many input arguments
—Input value cannot be gathered onto the host for rendering.disp: failed to gather value for display
RunMat:disp:TooManyOutputsAn output is requested from disp.disp does not return output arguments

How disp works

  • Accepts exactly one input argument; additional arguments raise a MATLAB-compatible error.
  • Numeric, logical, and complex arrays respect MATLAB’s column-major layout with right-aligned columns that honour the active numeric format.
  • N-D arrays (with three or more dimensions) display one 2-D slice at a time with MATLAB-style (:,:,[...]) = headers so each page mirrors the Command Window output.
  • Text inputs follow MATLAB conventions:
  • Character arrays print each row as plain text without surrounding quotes.
  • String scalars and arrays emit their contents (empty strings produce blank lines, missing strings render as <missing>).
  • Structures display one field per line using four-space indentation; nested arrays collapse to size/type summaries just like MATLAB.
  • Cell arrays print a compact grid using four-space indentation. Elements summarise their contents (e.g., [2x2 double], 'hello', "world").
  • gpuArray values are gathered to host memory before formatting so the output matches MATLAB.
  • Empty built-in numeric, logical, complex, character-array, string-array, and cell-array values produce no displayed text; an empty string scalar produces its documented blank line.

Does RunMat run disp on the GPU?

disp is a side-effecting sink. When the input (or nested values) reside on the GPU, RunMat gathers them to host memory using the active acceleration provider. Providers do not need to implement special hooks—the builtin always renders on the CPU before writing to standard output.

GPU memory and residency

disp is a side-effecting sink. When the input (or nested values) reside on the GPU, RunMat gathers them to host memory using the active acceleration provider. Providers do not need to implement special hooks—the builtin always renders on the CPU before writing to standard output.

Examples

Printing a message in the Command Window

disp("Simulation complete.")

Expected output:

Simulation complete.

Displaying numeric vectors with MATLAB spacing

angles = [0 pi/6 pi/4 pi/3];
disp(angles)

Expected output:

0    0.5236    0.7854    1.0472

Showing a matrix without variable names

A = [1 23 456; 78 9 10];
disp(A)

Expected output:

1    23   456
    78     9    10

Printing struct fields in the Command Window

cfg = struct("solver", "bicgstab", "tolerance", 1e-8);
disp(cfg)

Expected output:

solver: "bicgstab"
  tolerance: 1e-08

Displaying gpuArray data without manual gather

G = gpuArray([1 2; 3 4]);
disp(G);             % RunMat gathers and prints host-formatted output automatically

Expected output:

1     2
     3     4

Showing string and character arrays

names = ["alpha" "beta"; "gamma" "delta"];
disp(names);
disp('RunMat')

Expected output:

"alpha"    "beta"
"gamma"    "delta"
RunMat

Using disp with coding agents

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

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

FAQ

Does disp change the result of my computation?⌄

No. disp produces no output argument; requesting one is an error.

Can I pass multiple arguments to disp?⌄

No. Like MATLAB, RunMat accepts exactly one input argument. Use fprintf or sprintf for formatted output with multiple values.

How are structs displayed?⌄

Each field appears on its own line with a four-space indent, followed by the formatted value. Nested values collapse to MATLAB-style summaries (for example, [3x3 double]), so even large structures remain readable.

What happens with empty arrays?⌄

Empty built-in numeric, logical, complex, character-array, string-array, and cell-array values return without displaying text. An empty string scalar displays a blank line.

Can disp print GPU data directly?⌄

Yes. You do not need to call gather yourself. RunMat gathers GPU-resident values internally, prints the MATLAB-compatible representation, and leaves residency decisions to the auto-offload planner.

How are missing strings shown?⌄

Missing string scalars are rendered as <missing>, mirroring MATLAB output.

Does disp honour the current numeric format (e.g., format long)?⌄

Yes. disp reuses the same formatting primitives as the Command Window, so global format settings (format short, format long, etc.) apply automatically.

Does disp add a blank line after printing?⌄

It prints each line followed by a newline. Empty strings result in a blank line, consistent with MATLAB.

What if the input is a cell array?⌄

RunMat prints a compact cell view using four-space indentation and MATLAB-style summaries ([2x2 double], 'text', "string"). Nested cell arrays appear as [mxn cell].

How do I print without a trailing newline?⌄

Use fprintf instead. disp always terminates the output with a newline.

Related Io functions

Net

accept · read · readline · tcpclient · tcpserver · write

Repl Fs

addpath · cd · copyfile · delete · dir · exist · fileattrib · fileparts · fullfile · genpath · getenv · getpref · isenv · isfile · isfolder · ispref · ls · matlabroot · memmapfile · mkdir · movefile · open · opentoline · path · pathsep · pcode · pwd · readstruct · rehash · restoredefaultpath · rmdir · rmpath · run · savepath · setenv · setpref · system · tempdir · tempname · uigetdir · uigetfile · uiputfile · unsetenv · userpath · what · winqueryreg · xmlread · xmlwrite

Tabular

arrayDatastore · csvread · csvwrite · detectImportOptions · dlmread · dlmwrite · fileDatastore · parquetDatastore · parquetinfo · parquetread · readcell · readmatrix · readtable · readtimetable · spreadsheetImportOptions · writecell · writematrix · writetable · writetimetable · xlsread · xlswrite

Audio

audioinfo · audioread

Io

clc · diary · display · format · input

Filetext

fclose · feof · fgetl · fgets · fileread · filewrite · fopen · fprintf · fread · frewind · fwrite · readlines · writelines

Archive

gunzip · gzip · unzip

Hdf5

h5disp · h5info · h5read · h5write · h5writeatt · hdf5info · hdf5read · hdf5write

Import

importdata · textscan

Json

jsondecode · jsonencode

Mat

load · matfile · save

Http

sendmail · urldecode · urlencode · weboptions · webread · websave · webwrite

Open-source implementation

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

  • View the source for disp 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
  • Errors
  • How disp works
  • Does RunMat run disp on the GPU?
  • GPU memory and residency
  • Examples
  • Printing a message in the Command Window
  • Displaying numeric vectors with MATLAB spacing
  • Showing a matrix without variable names
  • Printing struct fields in the Command Window
  • Displaying gpuArray data without manual gather
  • Showing string and character arrays
  • Using disp with coding agents
  • FAQ
  • Related Io functions
  • Net
  • Repl Fs
  • Tabular
  • Audio
  • Io
  • Filetext
  • Archive
  • Hdf5
  • Import
  • Json
  • Mat
  • Http
  • Open-source implementation
  • About RunMat