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

조회 수: 8 (최근 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
Sadiq Akbar
Sadiq Akbar 2020년 10월 15일
Ok thank you very much dear Ameer Hamza for your kind support and devoted help. May you live long happily.
Sadiq Akbar
Sadiq Akbar 2020년 10월 15일
https://www.mathworks.com/matlabcentral/answers/615303-how-to-export-a-figure-into-ms-word

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by