How to make program window and figure centered using GUI and varargout = guidefunc(action, varargin).

조회 수: 1 (최근 30일)
I have been given this code to edit and make usable for an upcoming experiment. However, i am having issues loading the window fullscreen, and whenn it does load fullscreen the interactive figures are placed in the bottom left instead of the center of the screen. How can i code this to run fullscreen and have the interactive figure in the center of the screen. I have attatched an image for reference to what i am talking about. I have also attetched an image of what i beleive to be the code in control of the placement, so i would like to know what i change.
Thank you
Screen Shot 2019-12-16 at 12.36.48 pm.png
Screen Shot 2019-12-16 at 12.33.13 pm.png
  댓글 수: 7
Moshe Meyers
Moshe Meyers 2019년 12월 17일
OMG it works, thank you so much! super tedious but it is working. Thannk you!

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

채택된 답변

Rik
Rik 2019년 12월 17일
Since it apparently solved your issue, I'll move my comment to the answer section:
As you can see in the first screenshot the Units property of your figure is Pixels, not Normalized. But actually, that is not relevant. The buttons and other objects have a position relative to their container. That container is very likely to be the figure. That means their Position is relative to the figure. If those are in Pixel units as well, that means their position is encoded as a specific number of pixels away from the lower left corner. If you change the Units property to Normalized for all your buttons and other objects, they will be defined as a percentage of the figure width and height.
Note that changing the Units to Normalized also means that the aspect ratio of your buttons will change if the aspect ratio of your figure changes. Note that you might have to modify the font size as well to prevent large buttons with tiny text.
NB: apply these changes through the GUIDE interface, not in the fig file directly. If you would have been handed a GUI built from code, this would be a lot easier, but now you must either recreate the fig from code, or stick to GUIDE.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by