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

    function [MP] = modifyData(MP, pData, newData)
%MODIFYDATA function to replace data in the project with new data
%
%  PROJECT = MODIFYDATA(PROJECT, PDATA, NEWDATA)
%  

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

oldData = pData.info;
% Update the data ... do we need to create a new top level sweepset
[~, ~, newSS] = getOriginal(newData);
[~, ~, oldSS] = getOriginal(oldData);

pVal= children(MP,@getValDataPtr);
IsValData= [pVal{:}]==pData;
if any(IsValData)
    % getValDataPtr returns an empty pointer if there is no validation data
    TPindex = find(~cellfun(@isempty,pVal));
    % delete validation data in test plans
    children(MP,TPindex(IsValData),@valdata,[])
end

% What are the dependancies of this data object
pDepend = getDataDependancies(MP, pData);
% Has the underlying sweepset changed?
if isempty(pDepend) || isempty(oldSS) || isequal(newSS, oldSS)
    % No change at all or Changed ... but no one else is dependent on the parent
    pData.info = pData.assign(newData);
else
    % Changed ... someone else is dependent on the parent so copy the
    % sweepset to a new location on the heap
    pData.info = copy(newData);
end