movegui

Moves a figure to the specified position.

Syntax

movegui()

movegui(position)

movegui(h)

movegui(h, position)

movegui(h, event)

movegui(h, event, pos)

Inputs

h
Handle of a graphics object. If the graphics object is not a figure then its parent figure will be moved to the specified position.
Type: double
Dimension: scalar
position
Specifies the position of the figure. Valid values are one of the predefined strings or a 2-element real vector specifying the offset between the figure's window lower left corner and the lower left corner of the screen. If a negative value is passed then it is considered as the offset between the figure's window top right corner and the top right corner of the screen.
Valid values are:
  • 'north'
  • 'south'
  • 'east'
  • 'west'
  • 'northeast'
  • 'northwest'
  • 'southeast'
  • 'southwest'
  • 'center'
  • 'onscreen', in case a part of the figure is outside of the screen area the figure will be moved horizontally and/or vertically so that the figure is fully visible. A padding of 30 pixels is added. This is the default action if a position value is not given.
  • or a 2-element real vector, ([h, v]), a positive h/v value indicates the offset between the figure's left/bottom point and the screen's left/bottom point. A negative h/v value indicates the offset between the figure's right/top point and the screen's right/top point.
Type: String or 2-element vector
Dimension: scalar | vector
event
event is currently ignored.

Examples

Place figure at the top of the screen:

figure('windowstyle', 'undocked');
movegui('north');

Place figure at a 200 pixel offset from the left of the screen and 100 pixel offset from the top of the screen:

figure('windowstyle', 'undocked');
movegui([200 -100]);

Comments

In a setup with multiple monitors, the position is calculated relative to the monitor that the figure (or the better part of it) is currently in.

movegui has no effect if the figure is 'docked'.