Why does COPYOBJ reverse the order of copied objects when copying mutliple objects at once?
2 views (last 30 days)
Show older comments
Why does COPYOBJ reverse the order of copied objects when copying mutliple objects at once?
If I use COPYOBJ to copy a group of handle graphics objects from one parent to another, the ordering of the copied objects is opposite to the original objects. In other words, objects that were originally in the foreground of the figure are moved to the background.
For example, if I create two patches:
ax1=axes;
patch([0 0 1 1],[0 1 1 0],'b')
hold on
patch([0 0.5 1],[0 1 0],'r')
title('Original Image')
and then copy them to a new axes using COPYOBJ:
fig2=figure('units','norm','pos',[0.5 0.5 0.4 0.4]);
ax2=axes;
newkids=copyobj(get(ax1,'children'),ax2);
The second patch has been moved to the background and can no longer be seen.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
This issue has been forwarded to our development staff for their consideration.
As a workaround, you can use the FLIPUD command to reverse the order of the vector of handles.
Instead of:
copyobj(handles_vector,parent)
You can use:
copyobj(flipud(handles_vector),parent)
0 Comments
More Answers (0)
See Also
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!