www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@axestext/copyobj.m

    function newobj = copyobj(obj,fH)
%COPYOBJ  Copy an axestext object to another set of axes
%    newobj = copyobj(obj,fH)

%  Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc.

% First ensure that new figure has an  axes to attach to
aH = axes('Parent',fH,...
    'Units','pixels',...
    'Position',get(0,'DefaultUicontrolPosition'),...
    'XLim',[0 1],...
    'YLim',[0 1],...
    'Visible','off');

% Copy the object
newobj = obj;

% Now copy the text to the new figure
newobj.wrappedobject = copyobj(obj.wrappedobject, aH);
% copy background rectangle
newobj.background = copyobj(obj.background, aH);

% copy the user data (not done by copyobj)
set(newobj.wrappedobject,'UserData',get(obj.wrappedobject,'UserData'))
newobj.axes = aH;