| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
V = h.move(position)
V = move(h, position)
V = h.move(position) moves the control to the position specified by the position argument. When you use move with only the handle argument, h, it returns a four-element vector indicating the current position of the control.
V = move(h, position) is an alternate syntax.
The position argument is a four-element vector specifying the position and size of the control in the parent figure window. The elements of the vector are:
[x, y, width, height]
where x and y are offsets, in pixels, from the bottom left corner of the figure window to the same corner of the control, and width and height are the size of the control itself.
This example moves the control:
f = figure('Position', [100 100 200 200]);
h = actxcontrol('mwsamp.mwsampctrl.1', [0 0 200 200], f);
pos = h.move([50 50 200 200])
pos =
50 50 200 200
The next example resizes the control to always be centered in the figure as you resize the figure window. Start by creating the script resizectrl.m that contains
% Get the new position and size of the figure window fpos = get(gcbo, 'position'); % Resize the control accordingly h.move([0 0 fpos(3) fpos(4)]);
Now execute the following in MATLAB or in an M-file:
f = figure('Position', [100 100 200 200]);
h = actxcontrol('mwsamp.mwsampctrl.1', [0 0 200 200]);
set(f, 'ResizeFcn', 'resizectrl');
As you resize the figure window, notice that the circle moves so that it is always positioned in the center of the window.
![]() | more | movefile | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |