MATLAB: Am I unable to access application data for graphics objects created by using the copyobj function in MATLAB R2014b

MATLABr2014bgraphics

I have an axes which contains a surface plot. I assign application data to the axes object using the following command:
setappdata(axesHandle,'data',data)
I then copy the axes to another figure using the 'copyobj' function in the following way:
f = figure;
new_axes = copyobj(axesHandle,f);
In MATLAB R2014a, I the new axes in the new figure has the sample application data as the original axes, however in MATLAB R2014b the new axes does not have the same application data compared to the original axes. Why is that so?

Best Answer

Starting in R2014b, 'copyobj' does not copy callback properties or application data associated with graphics objects. The copied object has callbacks set to empty character arrays and application data set to empty structure arrays. Copies of objects might not behave as expected. For example, clicking a push button on the copy of a uicontrol has no effect.
If you want to create a copy of an object that has callbacks, then rerun the code used to create the first object to create a second object.
If you have existing code that uses 'copyobj' to copy callbacks, then you can use 'copyobj' with the 'legacy' option, for example,
c = copyobj(h,p,'legacy').
The behavior of the 'legacy' option is consistent with versions of MATLABĀ® before R2014b.