MATLAB: How to get a surface handle

gcfhandlesurface

Hello together,
in the Matlab Help for surf it Shows the command
h = surf(…) which returns a handle to a chart surface graphics object.
I'm not quite sure, what h is. Whats the difference to the handle I get, calling gcf?
My question is: How can I get the same handle like h just after I plotted the surface.
So i want to plot the surface with
surf(…) (without using h = surf(….))
and then later get the handle created with h.
Is this possible?
Thank you for your help

Best Answer

gcf returns the handle of the active figure. The figure is the entire window, including all menus, all buttons, all graphs, and so on. The handle returned by surf() is the handle just for the one surface.
If you do not record the handle at the time the surface is created, then you can use findobj to look for it:
findobj(gcf, 'type', 'surface')
provided the current figure has not changed.