Difference between properties and handles of figure

2 Ansichten (letzte 30 Tage)
Moritz
Moritz am 27 Apr. 2015
Kommentiert: Moritz am 29 Apr. 2015
I'm trying to understand the difference between the handles of a figure and the property values of a figure.
for example I can use
h=figure
then I can get the properties of h by using inspect. Also I can get the handles by using handles=guihandles(h).
What is the difference between those values and are the property values of the figure actually somewhere in the handles too?
Another thing, if I use handles=guihandles(h) and then handles.FigureToolBar.Visible='off' my figure is directly updated. So why do I need to call guidata(h,handles) as I have seen in some documentations?
Thanks a lot for helping
  2 Kommentare
per isakson
per isakson am 27 Apr. 2015
Which version of Matlab? See GUI Building Changes in R2014b. Make sure you use documentation that matches the release you are using.
Moritz
Moritz am 27 Apr. 2015
2015a mainly

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 27 Apr. 2015
The figure command replies the "handle" of the figure, which is a kind of pointer to it. You can use it to identify the figure uniquely and access its properties.
The command guihandles creates a struct, which makes it easy to access the propertioes of the figure (or other GUI object).
guidata writes or reads a struct from the figure's ApplicationData, which is useful to share data between callbacks of a figure. The usual name "handles" for this struct is confusing, because it can contain anything and not only handles. "guidata" would be a much better name, but unfortunately this is used for the command already.
  1 Kommentar
Moritz
Moritz am 29 Apr. 2015
thanks a lot for the explanation. Could you comment on the difference between the values that I see when using the property inspector and the values that I see when looking at the struct using guihandles?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by