www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevtestplan/setupTSSF.m

    function T= setupTSSF(T,Dp)
%setupTSSF setup data for use with a test plan. 
%   T = setupTSSF(T,Dp);
%   setupTSSF makes a copy of the data if it is used by another test plan.

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


if nargin>1
    % use supplied dataset
    T.DataLink = Dp;
    % Modified the testplan so update the internal pointer - needed to
    % ensure that the call to testplansweepsetfilter has an up-to-date
    % internal pointer to T
    xregpointer(T);
end

% make testplan sweepset filter
ssf = sweepsetfilter(T.DataLink.info);

if numstages(T)==1 && numstages(sweepset(ssf))~=1
    % upgrade from old projects keeps reorder sweeps
    % this needs to be removed using a hack!!
    ssf = reorderSweeps(ssf,Inf);
end

% choose data object and make tssf
tssf = testplansweepsetfilter(ssf, T);

% update project data list as required
MP = info(project(T));
if  numSharedData(MP,T.DataLink) > 1 
    % assign to new location if used in another testplan
    T.DataLink = xregpointer(tssf);
    % add to project list
    MP = addData(MP, T.DataLink);
else
    % place in present location
    T.DataLink.info = tssf;
end

% Update the internal pointer
xregpointer(T);

cleanupData(MP,address(T));