how to know the dimension of a figure window and then draw my own according to same dimension

13 次查看(过去 30 天)
If I have a figure window which is open. How can I know its dimesnion? I mean how can I know its size (length and width)? Once I know the dimesnion of the open figure window, then I want to draw my own figure window of the same dimension. How can we do that?

采纳的回答

Ameer Hamza
Ameer Hamza 2020-10-14
编辑:Ameer Hamza 2020-10-14
If it is already open and you don't have its handle, then first get it
fig = gcf(); % handle of current figure;
pos = fig.Position; % contains its position and dimensions
pos is 4 element vector [x y w h]. x and y are the positions of the bottom left corner of the figure window in screen coordinates (by default in pixels). w and h are the width and height of the window (by default in pixels too). Create a new figure at the same position and with the same dimensions
fig2 = figure('Position', pos)
  16 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Identification 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by