Why am I unable to access application data for graphics objects created by using the copyobj function in MATLAB R2014b?

3 views (last 30 days)
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?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Aug 2014
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.

More Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Products


Release

R2014b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!