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 个评论

请先登录,再进行评论。

采纳的回答

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