Difference between properties and handles of figure

1 view (last 30 days)
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

Accepted Answer

Jan
Jan on 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 Comment
Moritz
Moritz on 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?

Sign in to comment.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!