Skip to content

disp

Display the value of a variable without printing its name.

disp(X)

Prints the value of X to the command window. Unlike automatic display (a statement without trailing semicolon), disp doesn’t print the variable name as a prefix — useful for cleaner output when the name isn’t meaningful.

Works for any value type: numeric arrays, strings, cell arrays, structs, etc.

disp('Hello, world!')
disp(magic(3))
  • fprintf — Write formatted data to a file or the console.
  • sprintf — Format data into a string.