User`s guide

11 Lay Out a Programmatic GUI
set(object_handle,'Position',rect)
set(object_handle,'Units',myunits)
else
rect = [];
end
clipboard('copy', rect) % Place set string on system
% clipboard as well as returning it
The setpos function uses figure units to set the com ponent Position
property. First, setpos gets and saves the Units property of the component,
and sets that property to f igure units. After setting the object position, the
function restores the original units of the object.
The following steps show how to use
setpos to reposition a button away from
its default position:
1 Put this statement into your GUI code file, and then execute it:
btn1 = uicontrol('Style','pushbutt on',...
'String','Push Me');
2 Put the following statement in your GUI code file, execute it, and then
drag out a P osition for object
btn1.
rect = setpos(btn1)
11-50