Difference between properties and handles of figure
1 view (last 30 days)
Show older comments
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 Comments
per isakson
on 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.
Accepted Answer
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.
More Answers (0)
See Also
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!