How can I change the default units in GUIDE

13 ビュー (過去 30 日間)
Yuval Cohen
Yuval Cohen 2014 年 4 月 10 日
回答済み: Robert Thomas 2022 年 9 月 30 日
Hello, I use GUIDE for many of my GUIs. I like using 'pixels' for the figure and all uicontrols. Unfortunately, the default units are 'characters' and I have to manually change the unit value for every new uicontrol I add.
Is there a way to change the default units?
Thank you, Yuval

回答 (4 件)

Image Analyst
Image Analyst 2014 年 4 月 17 日
You can't change the default as far as I know. You need to set up each one. However they don't need to be done one at a time in the Property Inspector, and you don't need to write something into every CreateFcn. You can set them all as a group (well almost all). What you can do is to drag a box around all the controls on your figure to select all of them. Then double-click on any one of them to bring up the Property Inspector. It will list only those properties that apply to all of them, and some will be missing because some controls don't have certain properties. Fortunately "Units" is one of those that will be shown. You can change the units to pixels for all the controls that you have selected, then close the property inspector. The only ones it won't apply to are those controls that are located inside a panel (group box). For those you have to set them one at a time.

nl2605 2014 年 4 月 17 日
In the CreateFcn you can change the units as you want them to be. But yes, you will have to write it in every CreateFcn of your figure components.

Sean de Wolski
Sean de Wolski 2014 年 4 月 17 日
In general, you can do this if you were making programmatic UIs. However, GUIDE sets its own defaults that can't be changed to my knowledge.
With a regular figure:
hFig = figure;
I would recommend IA's approach. You can also right click a graphics component in GUIDE to make a copy of it. That way you change the properties once, right click and drag to get an identical object.
  1 件のコメント
Image Analyst
Image Analyst 2014 年 4 月 17 日
Neat trick (right click and drag). I was always using control c, control v to create a copy of a control.


Robert Thomas
Robert Thomas 2022 年 9 月 30 日
majority of students find to be quite uninteresting and challenging It is because they place a greater emphasis on raising their grades than on developing their creativity It is true that you must adhere to the instructions provided by your professor sad story ideas There are some times when in life things do not go the way we want We have no choice but to accept them as they are or deal with them.


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