Hello,
I'm using the following script. If I run each line individually, it gives the right Position so I can get the Width and Height of the figure. But when I use it in a script it keeps giving me the position from before maximizing it.
When asking for the Position after running the script, it gives the right Position too.
is there any way I can resolve that problem?
%% Creating GUI
GUI=uifigure('Name','Spectrograms',...
'NumberTitle','off',...
'WindowState','maximized');
% get window size
Position=get(GUI, 'Position');
GUI_Width=Position(3);
GUI_Height=Position(4);

댓글 수: 1

The uifigure does not exist before you create it so I am not sure what value from "before" you maximized it that you are referring to?

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

 채택된 답변

Arthur Roué
Arthur Roué 2020년 7월 21일

0 개 추천

Add a call to drawnow after creating the figure
%% Creating GUI
GUI=uifigure('Name','Spectrograms',...
'NumberTitle','off',...
'WindowState','maximized');
% Update figures and process callbacks
drawnow;
% get window size
Position=get(GUI, 'Position');
GUI_Width=Position(3);
GUI_Height=Position(4);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

릴리스

R2019b

질문:

2020년 7월 21일

댓글:

2020년 7월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by