Borrar filtros
Borrar filtros

I did not find in the documentation. What is the meaning of set(0,....). What does 0 signify?

1 visualización (últimos 30 días)
I did not find in the documentation. What is the meaning of set(0,....). What does 0 signify? I know that it is the handle? Is the first handle always 0? What does this mean?

Respuesta aceptada

Stephen23
Stephen23 el 18 de En. de 2015
The 0 refers to the "root", from where all graphics properties are inherited when a figure is created. By changing the values in the root, all graphics objects that are created will inherit that property, unless otherwise specified, eg:
set(0,'DefaultAxesLineStyleOrder',{'-o',':s','--+'})
The documentation of R2010b states:
The root is a graphics object that corresponds to the computer screen. There is only one root object and it has no parent. The children of the root object are figures.
The root object exists when you start MATLAB; you never have to create it and you cannot destroy it. Use set and get to access the root properties.
On more recent version of MATLAB, the 0 has been replaced by groot .

Más respuestas (1)

Titus Edelhofer
Titus Edelhofer el 18 de En. de 2015
Hi,
the 0 is the root of the graphics system. It contains information like screen resolution:
get(0)
CallbackObject: []
Children: []
CurrentFigure: []
FixedWidthFontName: 'Courier New'
HandleVisibility: 'on'
MonitorPositions: [1 1 1920 1080]
Parent: []
PointerLocation: [913 357]
ScreenDepth: 32
ScreenPixelsPerInch: 96
ScreenSize: [1 1 1920 1080]
ShowHiddenHandles: 'off'
Tag: ''
Type: 'root'
Units: 'pixels'
UserData: []
Since R2014b handles are objects and not plain numbers. So you can still use the 0 for backward compatibility, but preferred is to use groot instead.
doc groot
Titus
  3 comentarios
Titus Edelhofer
Titus Edelhofer el 18 de En. de 2015
Hi IA,
yes, you can. Normalized works fine, but as you already observed, just to some extent. Designing your app on Full HD and run it on a 1024x768 will probably not work.
What I do is to add some switchyard when opening the app, something like
res = get(groot, 'ScreenSize');
if res(3)>=1920
% Full HD
% Set some properties accordingly
elseif res(3)>=1400
% This used to be the resolution of my laptop
else
warning('Low resolution, app will look ugly.');
end
Titus
Image Analyst
Image Analyst el 18 de En. de 2015
Well yes, but it's the "Set some properties accordingly" part that I need. I don't know what to change to fix it. I imagine that if the low res computer were setting up the GUI with GUIDE, they could get it to look fine, so what are the properties that I need to change? Just bump down all the font sizes or something? Is there something more global than that? I don't want to manually fix the properties of every single one of the 20 or 30 controls on the GUI if possible.

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Object Properties en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by