Move UI figure to specified location on screen
moves the figure identified by handle
h to the
specified screen location, preserving the figure's size. The
is either a string or a two-element vector, as defined in the tables
movegui(h) moves the figure
identified by the handle
h to the
movegui moves the callback
gcbf) or the current figure (
onscreen position. You can specify
CreateFcn callback for a figure. Doing so ensures
after you save a figure, that figure appears on screen when you reload
it, regardless of its saved position. See the following example.
When it is a string,
one of the following descriptors.
|Top center edge of screen|
|Bottom center edge of screen|
|Right center edge of screen|
|Left center edge of screen|
|Top right corner of screen|
|Top left corner of screen|
|Bottom right corner of screen|
|Bottom left corner|
|Centered on screen|
|Nearest location to current location that is entirely on screen|
You can also specify the
as a two-element vector,
[h,v]. Depending on sign,
the figure's offset from the left or right edge of the screen, and
the figure's offset from the top or bottom of the screen, in pixels. The following table
summarizes the possible values.
Offset of left side from left edge of screen
Offset of right side from right edge of screen
Offset of bottom edge from bottom of screen
Offset of top edge from top of screen
movegui to a maximized figure
window moves the window towards the task bar and creates a gap on
the opposite side of the screen about as wide as the task bar. The
window might shrink in size by a few pixels. If you use the
with a maximized figure window, then
a gap on both the left and upper sides of the screen so that the top-left
corner of the figure is visible.
loading figures to ensure they are visible.
Ensure that a saved UI window appears on screen when you reload
it, regardless of the target computer screen size and resolution.
Create a figure that is off the screen, assign
CreateFcn callback, save the figure, and
then reload it.
f = figure('Position',[10000,10000,400,300]); % The figure does not display because % it is created offscreen. f.CreateFcn = @movegui; hgsave(f,'onscreenfig'); close(f); f2 = hgload('onscreenfig'); % The reloaded figure is now visible
Move a figure to the bottom left corner of the screen.
f = figure; movegui(f,'southwest');
Move a figure so that it is offset 100 pixels from the bottom and left side of the screen.
f = figure; movegui(f,[100,100]);