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

    function con = loadobj(con)
%LOADOBJ Load filter for 1d table 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, CONTABLE1/UPGRADE.

%  Copyright 2005-2008 The MathWorks, Inc.

if con.version == 1.5,
    warning(message('mbc:contable1:MissedUpgrade'));
end
if con.version <= 1,
    % Upgrade from version 1 to version 2 structure.
    %
    %          size: 4
    %     breakcols: [-1 -0.5000 0 0.5000 1]
    %         table: [1 1 1 1 1]
    %       factors: [1 2]
    %            le: 1
    %       version: 1
    %
    % Create parent abstract class
    con.conbase = conbase( coninputfactor( con.size ) );
    % However, the parent is really only at version 1.5 because it will
    % need an upgrade
    con.conbase = pSetVersionNumber( con.conbase, 1.5 );
    % The factor information is now stored in the in parent class
    con.conbase = setActiveIndices( con.conbase, con.factors );
    % Remove the size and factors fields from the structure
    con = mv_rmfield( con, {'size', 'factors'}  );
    % Partial increment of the version number:
    con.version = 1.5;
end
if isstruct( con ),
    % Convert the structure to an object.
    con = contable1( con );
end

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