www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@xregpointer/mapptr.m

    function p= mapptr(p,RefMap)
% XREGPOINTER/MAPPTR maps pointer from old to new references
%
% p= mapptr(p,{OldRefs,NewRefs})
%     This is mainly for use in loading pointers to new locations

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



OldRefs= RefMap{1};
NewRefs= RefMap{2};

ptr = p.ptr;
if ~isempty(ptr)
	ind= mbcbinsearch(OldRefs.ptr,ptr);
	ok= ind~=0 & ptr~=0;
	if any(ind==0 & ptr~=0)
		warning(message('mbc:xregpointer:PointerMatch'))
	end
	p.ptr(ok)= NewRefs.ptr(ind(ok));
end