| MATLAB Functions | Help Desk |
copyobj
Copy graphics objects and their descendantsnew_handle = copyobj(h,p)
copyobj creates copies of graphics objects. The copies are identical to the original objects except the copies have different values for their Parent property and a new handle. The new parent must be appropriate for the copied object (e.g., you can copy a Line object only to another Axes object).
new_handle = copyobj(h,p)
copies one or more graphics objects identified by h and returns the handle of the new object or a vector of handles to new objects. The new graphics objects are children of the graphics objects specified by p.
h and p can be scalars or vectors. When both are vectors, they must be the same length and the output argument, new_handle, is a vector of the same length. In this case, new_handle(i) is a copy of h(i) with its Parent property set to p(i).
When h is a scalar and p is a vector, h is copied once to each of the parents in p. Each new_handle(i) is a copy of h with its Parent property set to p(i), and length(new_handle) equals length(p).
When h is a vector and p is a scalar, each new-handle(i) is a copy of h(i) with its Parent property set to p. The length of new_handle equals length(h).
Graphics objects are arranged as a hierarchy. Here, each graphics object is shown connected below its appropriate parent object.
Copy a set of Patch handles into a new Figure by assigning the Parent property of the new Patch graphics objects to the current Axes:
X = rand(5,3); Y = rand(5,3); C = rand(1,3); h = fill(X,Y,C); figure % Create a new figure window axes % Create an axes object in the figure window new_handle = copyobj(h,gca);
findobj, gcf, gca, gco, get, set
Parent property for all graphics objects.