How can I lock resolution on images?

조회 수: 4 (최근 30일)
Stelios Fanourakis
Stelios Fanourakis 2019년 10월 6일
댓글: Walter Roberson 2019년 10월 7일
Hi
Let me give an example. I designed a GUI figure using GUIDE putting some elements upon it such as sliders, buttons, etc. This Figure was created in a small screen of 12 and 15" inches accordingly.
The pixel positions of the elements were set by that resolution. When I tried to project the same figure on a desktop screen with 22" or 25" size, I saw the sliders buttons and text frames displaced having their original position on screen that couldn't fit on a bigger screen with different resolution.
Is there a Matlab command to lock the positions of those elements according to their figure position no matter the screen size they are going to be displaced?
Thanks
Looking forward to your help.

답변 (2개)

Image Analyst
Image Analyst 2019년 10월 6일
Try setting the units property of all the controls to "pixels" if you want them at the same pixel position regardless of how many pixels are on different screens.
Try setting the units property of all the controls to "normalized" if you want them at the same relative position (percentage of way across or down the screen) regardless of how many pixels are on different screens.
  댓글 수: 5
Rik
Rik 2019년 10월 7일
You should be looking in the properties section of the graphics elements. Here is the explanation for figure. The idea is that the lower left corner is (0,0) and upper-right is (1,1), so you can essentially define the positions as percentages of the container. The container for undocked figures is the screen, for buttons it is either the figure, or a uipanel.
For a discussion about if GUIDE is the best tool for the job, I would invite you to have a read here.
Walter Roberson
Walter Roberson 2019년 10월 7일
On the smaller monitor, open the figure. Execute the command
set( findall(groot, '-property', 'Units'), 'Units', 'normalized')
Save the figure again. It can now be opened on the larger monitor and everything should scale.

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


Walter Roberson
Walter Roberson 2019년 10월 6일
There is a tension between elements of a GUI that is difficult to resolve by just resizing.
Graphs can mostly be resized arbitrarily as long as the aspect ratio is preserved. There is a lower limit below which not all of the detail can be discerned, but humans are pretty good at understanding that "space was limited" and mostly be forgiving as long as the general trend is still visible.
Text, however, gets unreadable below a point, and "looks wrong" if it is too large for the situation.
The proportions that are accepted for graphs are not the same proportions that are accepted for text.
Meanwhile, the sizes that are accepted for some of the user interface elements such as scroll bars sit within a narrow physical range, and do not scale well.
The result of all of this is that mostly you have to let the UI elements sit around a certain physical size without scaling, and that you probably want to constrain how large text will get, whereas graphs can scale up.
In particular, you probably want to re-flow text when you change the proportions of the container rather than scale it up proportionally. And if you define the size of a particular section of a ui as being "just large enough to comfortably fit this text" then you end up moving pieces of the interface around as you resize, and you start to have to develop rules such as "This element is variable in size to fit the current font size representation of this string, and this other element should be just to the right of it and the same height". You start to develop a "layout" instead of fixed positions.
Layouts are beyond the scope of GUIDE. App Designer starts to provide some layout tools.
  댓글 수: 2
Stelios Fanourakis
Stelios Fanourakis 2019년 10월 7일
Yes. you got what I am trying to do. Have the graphs and texts rescaled propotionally based on the rescaling of the main figure they are placed on. Is there a way to do it in GUIDE?? I don't know how to use AppDesigner
Walter Roberson
Walter Roberson 2019년 10월 7일
Have the graphs and texts rescaled propotionally based on the rescaling of the main figure they are placed on.
My experience with this topic is that rescaling everything proportionally will look bad.

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

카테고리

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