gcf() returns a figure handle. get() applied to it returns a struct of property values, and does not return the handle itself.
You are taking the struct of information returned from above, and setting the YData field of the struct to empty. But figures do not have a YData field, so this is creating a new YData field in the struct. If figures did have a YData field... then making that assignment would be overwriting the information structure, not changing the properties of the figure.
YData is a property of a number of different kinds of graphics objects, such as surfaces and line plots. Setting one YData for an object in the figure would affect only that one object, rather than clearing the axes or the figure.
You could do
objs = findobj(gcf, '-property', 'YData');
but that doesn't really clear the figure either: it would leave some objects in place and would make other objects invisible without deleting them.