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

    function con = loadobj(con)
%LOADOBJ Load filter for the abstract constraint class (CONBASE)
%
%  CON = LOADOBJ(CON)
%
%  For old forms of constraints, the LOADOBJ method updates the object
%  structure and partially increments the version number. Where required,
%  nominal values will be used for the variable information, etc. Use the
%  UPGRADE method to update this information.
%
%  See also LOADOBJ, CONBASE/UPGRADE.

%  Copyright 2005-2008 The MathWorks, Inc.

if con.Version == 1.5,
    warning(message('mbc:conbase:MissedUpgrade'));
end
if con.Version <= 1,
    % Upgarde from version 1 to version 2 structure.
    %
    %              Version: 1
    %            Variables: [1 1]
    %  SpecialPointOptions: []
    %     BdryPointOptions: []
    %      ModelFitOptions: []
    con.Name = 'Constraint';

    % The information about the number of factors and which ones are active was
    % stored in the "Variables" field.
    con.InputFactors = coninputfactor( length( con.Variables ) );
    con.ActiveFactors = find( con.Variables );

    % Store the old fit options in the version field
    % -- Partially increment the version number.
    con.Version = {1.5, con.SpecialPointOptions, con.BdryPointOptions, con.ModelFitOptions};

    % Remove old fields no longer used.
    con = mv_rmfield( con, {'Variables', 'SpecialPointOptions', ...
        'BdryPointOptions', 'ModelFitOptions'} );
end
if isstruct( con ),
    % Convert the structure to an object.
    con = conbase( con );
end

%--------------------------------------------------------------------------
% EOF
%--------------------------------------------------------------------------