display

Shows the value of a variable or object.

Category: Other public functions: lang

Syntax

display(x)

Prints x the way an unsuppressed statement would, labeled with the variable name.

Description

MATLAB calls display automatically when a statement without a semicolon produces a value, so writing x and display(x) normally print the same thing. Defining a display method for a class changes what is shown for its objects. Its usual role is therefore to be overloaded, while disp is the function used to print a value without the name.

Input arguments

x
Any value or object.

Example

Display a matrix

x = [1 2 3];
display(x)
Output
ans = 1×3

     1     2     3

Notes

MatLivre labels the printed value ans instead of the variable name, and MATLAB prints a variable with its own name.

See also

disp fprintf format inputname