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 月 16 日
編集済み: Rik 2019 年 12 月 17 日
moved to answer section
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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by