www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgddnode/replace.m

    function D = replace(D,old,new)
%REPLACE  Replace one variable with another
%
%  D = REPLACE(D, oldPtr, newPtr) replaces all instances in the whole
%  session of one item in the dd to another.

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


proj = project(D);
allitems = saveptrs(proj);

% Remapping just one pointer causes warnings that other pointers haven't been matched
% (This is a feature designed to make sense during loading)
oldwarn = warning('off','mbc:xregpointer:PointerMatch');    
RefMap = {old,new};
passign(allitems, pveceval(allitems, @mapptr, RefMap));
warning(oldwarn);

D = remove(D, old);
% make a new projconnections object
UpdateConnections(proj);