Documentation Center

  • Trial Software
  • Product Updates

Root Properties

Root properties

Modifying Properties

You can set and query graphics object properties in two ways:

  • Property Editor is an interactive tool that enables you to see and change object property values.

  • The set and get commands enable you to set and query the values of properties.

To change the default values of properties, see Setting Default Property Values.

Root Properties

This section provides a description of properties. Curly braces { } enclose default values.


cancel | {queue}

Not used by the root object.



Not used by the root object.


handle (read-only)

Handle of current callback's object. Contains the handle of the object whose callback routine is currently executing. If no callback routines are executing, this property contains an empty double array [ ]. See also the gco command.


vector of handles

Handles of child objects. A vector containing the handles of all nonhidden figure objects (see HandleVisibility for more information). You can change the order of the handles and thereby change the sorting order of the figures on the display.


{on} | off

Clipping mode. This property has no effect on the root object.


[columns rows]

    Note:   The CommandWindowSize root property will be removed in a future release. To determine the number of columns and rows that display in the Command Window, given its current size, call matlab.desktop.commandwindow.size.

Current size of command window. Size of the MATLAB® command window, in a two-element vector. The first element is the number of columns wide and the second element is the number of rows tall.

For example, a value of [50,25] means that 50 characters can display across the Command Window, and 25 lines can display without scrolling.

Enabling the Command Window Display preference Set matrix display width to eighty columns forces the returned value for number of columns wide to be 80 regardless of the window width.


The root object does not use this property.


figure handle

Handle of the current figure, which is the one most recently created, clicked in, or made current with the statement:

figure(h) % h is a figure handle

which re-sorts the figure to the top of the figures displayed on the screen, or:


which does not re-sort the figures. In these statements, h is the handle of an existing figure. If there are no figure objects:


returns an empty double array. Note, however, that gcf always returns a figure handle. Calling gcf creates a new figure if there are no existing figure objects that can become the current figure (for example, figures with hidden handles cannot become the current figure).



This property is not used because you cannot delete the root object.


on | {off}

Diary file mode. When this property is on, MATLAB maintains a file (whose name is specified by the DiaryFile property) that saves a copy of all keyboard input and most of the resulting output. See also the diary command.



Diary file name. The default name is diary. Set this property to the name of the file MATLAB uses write the command-line diary when the Diary property is set to on.


on | {off}

Script echoing mode. When Echo is on, MATLAB displays each line of a script file as it executes. See also the echo command.



Text of last error message. Contains the last error message issued by MATLAB.


font name

Fixed-width font to use for axes, text, and uicontrols whose FontName is set to FixedWidth. MATLAB uses the font name specified for this property as the value for axes, text, and uicontrol FontName properties when their FontName property is FixedWidth.

Specifying the font name with this property eliminates the need to hardcode font names in MATLAB applications and thereby enables these applications to run without modification in locales where non-ASCII character sets are required. In these cases, MATLAB attempts to set the value of FixedWidthFontName to the correct value for a given locale.

MATLAB application developers should not change this property, but should create axes, text, and uicontrols with FontName properties set to FixedWidth when they want to use a fixed-width font for these objects.

MATLAB end users can set this property if they do not want to use the preselected value. Courier is the default in locales that use Latin-based characters.


short | {shortE} | long | longE | bank |
hex | + | rat

Output format mode. Format used to display numbers. See also the format command.

  • short — Fixed-point format with 5 digits

  • shortE — Floating-point format with 5 digits

  • shortG — Fixed- or floating-point format displaying as many significant figures as possible with 5 digits

  • long — Scaled fixed-point format with 15 digits

  • longE — Floating-point format with 15 digits

  • longG — Fixed- or floating-point format displaying as many significant figures as possible with 15 digits

  • bank — Fixed-format of dollars and cents

  • hex — Hexadecimal format

  • + — Displays + and - symbols

  • rat — Approximation by ratio of small integers


compact | {loose}

Output format spacing (see also format command).

  • compact — Suppress extra line feeds for more compact display.

  • loose — Display extra line feeds for a more readable display.


{on} | callback | off

This property is not useful on the root object because the handle is always 0.


{on} | off

This property is not useful on the root object.


{on} | off

This property is not useful on the root object.



System environment setting.


Width and height of monitors, in pixels. Contains information about the size and relative location of monitors connected to your computer. The information returned by the MonitorPosition property depends on which computer system you are using.

Windows® Systems

Windows systems define one monitor as device 1, which becomes the reference by which MATLAB determines other monitor positions. The position data is of the form:


The values for minimum and maximum are relative to the origin.

The following picture show the values returned when querying the MonitorPositions property on a Windows system having two monitors arranged as shown.

The MonitorPositions property contains an n-by-4 array, with each row representing a monitor position. The first row is the nth monitor and the last row corresponds to device 1.

The monitor labeled as device 1 in the Windows control panel remains the reference monitor that defines the position of the origin however you reposition the monitors.

Linux® Systems

On Linux systems, the upper-left corner of a rectangle enclosing the system monitors forms the origin. The position data is of the form:

[xP yP widthP heightP;
 xS yS widthS heightS]

Where the values represent the offset from the left (x), the offset from the top (y), and the width and height of the monitor. The MonitorPositions property contains an n-by-4 array, with each row representing a monitor position. The first row is the position of the primary monitor.

The following picture show the values returned when querying the MonitorPositions property on a Linux system that has two monitors arranged as shown.

MATLAB on Linux reads control panel settings only at startup. MATLAB does not recognize changes made to the arrangement of monitors during a MATLAB session.

Macintosh Systems

MATLAB on Macintosh systems recognize only the main monitor. The position data is of the form:


Where the values are x = 0, y = 0, monitor width, and monitor height minus the height of the menubar.

The main monitor is determined by which display has the menu bar. The System Preferences Displays control panel provides a way to arrange representations of multiple displays, and set one as the main monitor. To make another display the main monitor, drag the representation of the menu bar in the panel from the default display to the other display.



Handle of parent object. This property always contains an empty double array, because the root object has no parent.



Current location of pointer. A vector containing the x- and y-coordinates of the pointer position, measured from the lower left corner of the screen. Move the pointer by changing the values of this property. The Units property determines the units of this measurement.

PointerLocation always contains the current pointer location, even if the pointer is not in a MATLAB window. A callback routine querying the PointerLocation property can get a value that is different from the location of the pointer when the callback was triggered. This difference results from delays in callback execution caused by competition for system resources.

On Apple Macintosh platforms, you cannot change the pointer location using the set command.


handle (read-only)

Handle of window containing the pointer. MATLAB sets this property to the handle of the figure containing the pointer. If the pointer is not in a MATLAB window, the value of this property is 0. A callback routine querying the PointerWindow can get the wrong window handle if you move the pointer to another window before the callback executes. This error results from delays in callback execution caused by competition for system resources.



Number of nested MATLAB file calls. The limit of the number of nested calls to MATLAB files that MATLAB makes before stopping (or potentially running out of memory). By default the value is set to a large value. Setting this property to a smaller value (something like 150, for example) should prevent MATLAB from running out of memory and instead causes MATLAB to issue an error when it reaches the limit.


bits per pixel

Screen depth. The depth of the display bitmap (the number of bits per pixel). The maximum number of simultaneously displayed colors on the current graphics device is 2 raised to this power.

ScreenDepth supersedes the BlackAndWhite property. To override automatic hardware checking, set this property to 1. Then MATLAB assumes the display is monochrome. Setting ScreenDepth to 1 is useful if MATLAB is running on color hardware but is being displayed on a monochrome terminal. Such a situation can cause MATLAB to determine erroneously that the display is color.


Display resolution

DPI setting for your display. Contains the setting of your display resolution specified in your system preferences.


four-element rectangle vector (read-only)

Screen size. A four-element vector:


that defines the display size. left and bottom are 0 for all Units except pixels, in which case left and bottom are both 1. width and height are the screen dimensions in units specified by the Units property.

Determining Screen Size

Note that the screen size in absolute units (for example, inches) is determined by dividing the number of pixels in width and height by the screen DPI (see the ScreenPixelPerInch property). This value is approximate and might not represent the actual size of the screen.

Note that the ScreenSize property is static. Its values are read-only at MATLAB startup and not updated if system display settings change. Also, the values returned might not represent the usable screen size for application developers due to the presence of other GUIs, such as the Microsoft® Windows task bar.


on | off

This property has no effect on the root object.


{on} | off

This property has no effect on the root object.


on | {off}

Show or hide handles marked as hidden. When set to on, this property disables handle hiding and exposes all object handles regardless of the setting of an object's HandleVisibility property. When set to off, all objects so marked remain hidden within the graphics hierarchy.



User-specified object label. Provides a means to identify graphics objects with a user-specified label. While it is not necessary to identify the root object with a tag (since its handle is always 0), you can use this property to store any string value, which you can later retrieve using get.


string (read-only)

Class of graphics object. For the root object, Type is always the string root.



This property is not used by the root object.


{pixels} | normalized | inches | centimeters | points | characters

Unit of measurement. Specifies the units MATLAB uses to interpret size and location data contained in the PointerLocation and ScreenSize properties. All units are measured from the lower left corner of the screen.

  • normalized — Map the lower left corner of the screen to (0,0) and the upper right corner to (1.0,1.0).

  • inches, centimeters, and points — Absolute units. 1 point = 1/72 inch.

  • characters — Based on the size of characters in the default system font. The width of one characters unit is the width of the letter x, and the height of one characters unit is the distance between the baselines of two lines of text.

If you change the value of Units, it is good practice to return it to its default value after completing your operation, so as not to affect other functions that assume Units is set to the default value.



User-specified data. Data you want to associate with the root object. The default value is an empty array. MATLAB does not use this data, but you can access it using the set and get commands.


{on} | off

Object visibility. This property has no effect on the root object.

See Also

Was this topic helpful?