display — Display a value with a MATLAB-style variable-name header.

display(X) prints a MATLAB-style display block for X. When the callsite argument is a simple variable name, RunMat uses that name as the header. Expression and literal arguments use ans as the header. For classdef objects that define or inherit a registered display method, RunMat dispatches the object method first; otherwise it falls back to the generic formatter shared with disp.

Syntax

display(X)

Inputs

NameTypeRequiredDefaultDescription
XAnyYesValue to display with a variable-name header.

Returns

NameTypeDescription
ansNumericArrayEmpty matrix placeholder returned by sink invocation.

Errors

IdentifierWhenMessage
RunMat:display:TooManyInputsToo many input arguments are passed to display.display: too many input arguments
RunMat:display:GatherFailedInput value cannot be gathered onto the host for rendering.display: failed to gather value for display

How display works

  • display(X) prints X = ... for simple variable arguments.
  • display(expr) prints ans = ... when the argument text is an expression, literal, or otherwise unavailable.
  • Single-line values are printed on the same line as the header.
  • Multi-line values such as matrices, structs, tables, datetime arrays, duration arrays, and N-D pages are printed below the header.
  • Objects and handle objects with a registered or inherited display method are dispatched through the class method surface before generic formatting.
  • display returns an empty numeric matrix placeholder internally and suppresses automatic output.

Does RunMat run display on the GPU?

display performs no provider kernel dispatch and is excluded from fusion planning.

Gather behavior is inherited from the same runtime gather path used by disp.

GPU memory and residency

display is a sink. Provider-resident inputs are gathered to host memory for formatting and the returned placeholder is host-side.

Examples

Display a named variable

A = [1 2; 3 4];
display(A)

Expected output:

A =
     1       2
     3       4

Display an expression

display(1 + 2)

Expected output:

ans = 3

Display a string

msg = "ready";
display(msg)

Expected output:

msg = ready

Using display with coding agents

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

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

FAQ

How is display different from disp?

disp(X) prints only the value. display(X) prints a variable-name header such as X = before the value.

Does display support class-specific output?

Yes for classes with a registered display method. The full matlab.mixin.CustomDisplay protocol is not yet modeled.

Does display gather GPU arrays?

Yes. Like disp, display formats on the CPU and gathers provider-resident data through the active acceleration provider.

Open-source implementation

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