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

    function con = upgrade(con, m)
%UPGRADE Upgrade a constraint to have model information
%
%  CON = UPGRADE(CON, M)
%
%  For old forms of the constraint, this method will take all the
%  appropriate information from the model, M, and update the
%  information in the constraint, CON. This includes updating
%  variable information and inverse coding any data stored in coded
%  units. The version number will also be updated by this method.
%
%  This method should be called from the LOADOBJ method of any object that holds
%  a constraint. Some objects may need to setup a post-load callback if they do
%  have an appropriate model at LOADOBJ time.
%
%  See also CONBASE/UPGRADE, CONBOOLEAN/LOADOBJ.

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

if con.Version < 2,
    m = pMakeFriend( con, m );
    % Upgrade parent
    con.conbase = upgrade( con.conbase, m );
    % Update version number
    con.Version = 2.0;
end

% Upgrade all stored held constraints
for i = 1:length( con.Constraints ),
    con.Constraints{i} = upgrade( con.Constraints{i}, m );
end


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