MATLAB Answers

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

조회 수: 2(최근 30일)
Moshe Meyers
Moshe Meyers 16 Dec 2019
편집: Rik 17 Dec 2019
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

표시 이전 댓글 수: 4
Moshe Meyers
Moshe Meyers 17 Dec 2019
OMG it works, thank you so much! super tedious but it is working. Thannk you!

로그인 to comment.

채택된 답변

Rik 17 Dec 2019
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

로그인 to comment.

추가 답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by