www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conrange/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, CONRANGE/LOADOBJ. % Copyright 2005-2007 The MathWorks, Inc. and Ford Global Technologies, Inc. if con.Version == 1.5, % Version 1.5 was used to indicate a version 1 object that had had its % object structure upgraded to version 2 but still needed to be mapped % from coded to natural units. warning(message('mbc:conrange:UpgradeError')); end if con.Version == 2.5, m = pMakeFriend( con, m ); % Upgrade parent con.conbase = upgrade( con.conbase, m ); % Adjust the Center and HalfWidth to take account of the change in coding con = pMapToNaturalUnits( con, m ); % Since we've changed the range of the input factors, we need to update % the scale factor that we're using. con = pSetScaleFactor( con ); % Update version number con.Version = 3.0; end