www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@constar/pUpgradeFitOptions.m

    function [newSpo, bpo, cfo] = pUpgradeFitOptions(con, oldSpo, bpo, ignoreCfo)
%PUPGRADEFITOPTIONS Upgrade fit options from an old version of the constraint
%
%  [SPO, BPO, CFO] = PUPGRADEFITOPTIONS(CON, SPO, BPO, CFO)
%
%  The inputs are the old version of the options that have been loaded from
%  a file. The outputs are  processed versions that have been made
%  up-to-date as necessary. 
%
%  See also CONSTAR,
%           CONBASE/LOADOBJ,
%           CONBASE/LOADFITOPTIONS.

%  Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc.

% Note that the boundary point options haven't changed.

% The old constraint fit options were stored in the constraint itself and
% we can pick those up by using the usual method
cfo = getConstraintFitOptions( con );

% Special point options
% -- First we create valid new options. We then modify these by considering
%    the old options. 
% -- Old vaue was a string. It was either 'LeastSquares' or 'MinEllipse'
newSpo = getspecialpointoptions(  con );
switch oldSpo
    case 'LeastSquares',
        newSpo = set( newSpo, 'CenterAlg', omMeanCenter( con ) );
    case 'MinEllipse',
        newSpo = set( newSpo, 'CenterAlg', omMinEllipseCenter( con ) );
    otherwise,
        if ischar( oldSpo ),
            warning(message('mbc:constar:InvalidState2', oldSpo));
        else
            warning(message('mbc:constar:InvalidState3'));
        end
end