MATLAB: What does the string in ‘DeleteFcn’ evaluate to

axestext;

I need to debug a piece of code and couldn't understand what the string in 'DeleteFcn' evaluate to. Also, what would the be the output of DeleteFcn attribute here
if true
c = text('Parent',b, ...
'DeleteFcn','eval(''delete(get(gcbo,''''userdata''''))'','''')', ...
'HandleVisibility','off', ...
'Tag','ColorbarDeleteProxy', ...
'UserData',66.0018, ...
'Visible','off');
end

Best Answer

That is a very badly written piece of code. DO NOT LEARN FROM IT.
Something like this is simpler, clearer, less buggy, and much easier to debug:
'DeleteFcn',@(~,~)delete(get(gcbo,'userdata')),...
Note that because that object's handle is provided anyway, it should probably be something like this:
'DeleteFcn',@(src,~)delete(get(src,'userdata')),...
Explanation: it gets the userdata field from the object and then deletes whatever that is. Presumably the userdata contains some graphics handle/s... Oh, It does: a hardcoded handle value.
Ouch.
This code makes me cry. Using gcbo and a hardcoded handle is a sign that the entire code needs a major revision.