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

    function con = loadobj(con)
%LOADOBJ Load filter for the two-stage constraint (CONTWOSTAGE)
%
%  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-2007 The MathWorks, Inc. and Ford Global Technologies, Inc.

if isstruct(con) && ~isfield( con, 'Version' ),
    % The version field was added at version 2. Any object without a
    % version field must be a version 1 object.
    con.Version = 1.0;
end
if con.Version == 1.6,
    % note the upgrade of version 1.5 could have failed due to some bugs in
    % contwostage/upgrade if the model is an xregmodswitch. Now we can fix
    % this upgrade and will only warn if a new corrupt upgrade is found
    warning(message('mbc:contwostage:MissedUpgrade'));
end

if con.Version < 2,
    % The only change from version 1 to version 2 is in the other objects
    % held by the contwostage and the addition of the LocalFriend field
    % (which is usually empty).
    %
    con.LocalFriend = [];
    % Mark constraint for upgrade
    con.Version = 1.6;
end
if isstruct( con ),
    % Convert the structure to an object.
    con = contwostage( con );
end

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|