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

    function con = loadobj(con)
%LOADOBJ Load filter for linear constraint objects
%
%  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/LOADOBJ, CONLINEAR/UPGRADE.

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

if con.version == 1.5,
    warning(message('mbc:conlinear:MissedUpgrade'));
end
if con.version <= 1,
    % Upgarde from version 1 to version 2 structure.
    %
    %           A: [1 1 1 1]
    %           b: 0
    %     version: 1
    %
    % Create parent abstract class
    con.conbase = conbase( coninputfactor( length( con.A ) ) );
    % However, the parent is really only at version 1.5 because it will
    % need an upgrade
    con.conbase = pSetVersionNumber( con.conbase, 1.5 );
    % Add the new scale factor field
    %  -- update the value in the constructor
    con.ScaleFactor = [];
    % Partial increment of the version number:
    con.version = 1.5;
end
if isstruct( con ),
    % Convert the structure to an object.
    con = conlinear( con );
end

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