www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@contable1/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, CONTABLE1/LOADOBJ. % Copyright 2005-2007 The MathWorks, Inc. and Ford Global Technologies, Inc. if con.version == 1.5, m = pMakeFriend( con, m ); % Upgrade parent con.conbase = upgrade( con.conbase, m ); % Adjust the "breakcols" and "table" to take account of the change in coding % -- The INVCODE method of the model can map these values from coded % units to natural units. ai = getActiveIndices( con ); con.breakcols(:) = invcode( m, con.breakcols(:), ai(1) ); con.table(:) = invcode( m, con.table(:), ai(2) ); % Update version number con.version = 2.0; end %------------------------------------------------------------------------------| % EOF %------------------------------------------------------------------------------|