www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@calibrationdata/@calibration/pDoSetCurve.m

    function pDoSetCurve(obj, curvesI)
%PDOSETCURVE  Private method.

%  Implementation for setCurve.

%  Copyright 2000-2005 The MathWorks, Inc.


% Get identifiers of inbound (I) and existing (E) items
identifiersI = get(curvesI, {'Identifier'}); % identifiers of incoming items
curvesE = obj.Curves; % existing items
identifiersE = get(curvesE, {'Identifier'});

% Get identifiers of inbound (I) and existing (E) referenced items
axisIdentifiersI = get(curvesI, {'XAxisIdentifier'});
axesE = obj.Axes;
axisIdentifiersE = get(axesE, {'Identifier'});

if numel(curvesI) > 1 && obj.phHasDuplicates(identifiersI)
    % Items to add have duplicate identifiers
    error(message('mbc:calibrationdata:calibration:InvalidOperation15'))
elseif any(~ismember(axisIdentifiersI, axisIdentifiersE))
    % Incoming item references non-existent dependent
    error(message('mbc:calibrationdata:calibration:InvalidOperation16'))
else
    [match, position] = ismember(identifiersI, identifiersE);
    if any(~match)
        error(message('mbc:calibrationdata:calibration:ObjectNotFound10'))
    else
        % Copy
        curvesI = copy(curvesI);
        % Strip out calibration interface
        curvesI.pClearCalibrationInterface;
        % Set
        curvesE(position) = curvesI;
        obj.Curves = curvesE;
    end
end