www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conrange/loadobj.m
function con = loadobj(con) %LOADOBJ Load filter for range 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, CONRANGE/UPGRADE. % Copyright 2005-2006 The MathWorks, Inc. if con.Version == 1.5 || con.Version == 2.5, warning(message('mbc:conrange:MissedUpgrade')); end if con.Version <= 1, % Upgrade from version 1 to version 2 structure. -- The structure does % not change but the parent (conbase) has significantly changed and we % need to take account of that in the UPGRADE method. We mark this % object with version 1.5 and then complete the transformation to % version 2 in the UPGRADE method. % % Version: 1 % Center: [0.5000 0.5000] % HalfWidth: [0.5000 0.5000] % conbase: [1x1 conbase] % % Partial increment of the version number: con.Version = 1.5; end if con.Version <= 2, % Upgrade from version 2 to version 3 structure. % -- Add the scale factor field. This will get set in the constructor. con.ScaleFactor = []; % Increment the version number: % -- We would like to set this to 3. However, it is possible that the % version number at this point is 1.5 or 2. Hence we increment by % adding 1 to the current version number. Thus the UPGRADE method % can look for a version 2.5 object and know to process it. con.Version = con.Version + 1; end % When adding a new version, don't forget to check whether the upgrade % method needs to be changed. if isstruct( con ), % Convert the structure to an object. con = conrange( con ); end