How do I copy a figure object and its descendants to another object of the same class in MATLAB?
23 views (last 30 days)
The function COMPCOPY below is an example of how to implement such a functionality.
function compCopy(op, np)
%COMPCOPY copies a figure object represented by "op" and its % descendants to another figure "np" preserving the same hierarchy.
ch = get(op, 'children');
nh = copyobj(ch,np);
for k = 1:length(ch)
The function can be used as follows
hf1 = figure;
ax1 = subplot(211);
ax2 = subplot(212);
hf2 = figure;
For information on the COPYOBJ function execute the following at the MATLAB command prompt:
More Answers (0)