www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevtestplan/Restore.m
function T= Restore(T,OldTP,oldTSSF,DO_DELETE) %RESTORE restore test plan to previous state % % T= Restore(T,OldTP,oldTSSF,DO_DELETE) % DO_DELETE is a flag indicating whether to remove extra datasets from % the project data list. Extra data sets are created when a dataset used % by another dataset is selected. In this case a duplicate TSSF is % created using the same base data. % Copyright 2000-2008 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin<4 % by default data objects will be removed from the project data list if % the newly selected data is duplicate of another dataset. DO_DELETE = true; end % restore old testplan [xp,yp]= dataptr(T); newp=0; % delete extra data set objects which have been created MP = info(project(T)); if IsMatched(OldTP) && isvalid(OldTP.DataLink); OldTP.DataLink.info= oldTSSF; else OldTP.DataLink = xregpointer; end xregpointer(OldTP); cleanupData(MP,address(T),DO_DELETE); if ~IsMatched(OldTP) % data design might have done a match - this creates pointers for data if OldTP.DataLink==0 && yp~=0 freeptr(xp); freeptr(yp); [xp,yp]= dataptr(OldTP); end else % restore old match if numstages(T)~= numstages(OldTP) newp= 1; freeptr(xp); freeptr(yp); [xp,yp]= dataptr(OldTP); end end pointer(OldTP); if newp % restore data OldTP= AssignData(OldTP,{xp,yp}); % keep children ch= children(T); OldTP= AssignChildren(OldTP,ch); end T= OldTP;