www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregtwostagebdrydev/loadobj.m
function bdev = loadobj(bdev) %LOADOBJ Load filter for two-stage boundary dev class (XREGTWOSTAGEBDRYDEV) % % BDEV = LOADOBJ(BDEV) % % See also XREGTWOSTAGEBDRYDEV % Copyright 2005 The MathWorks, Inc. if bdev.Version <= 1, % Upgarde from version 1 to version 2 % % There is no change to the object structure. Instead, this is the % point we moved from code to natural units for the constraints. Thus % all the values stored in LocalParameters will be wrong and need to be % upgraded. To this we get the global models from the two-stage and % evaluate them at the global points. This will give the new values for % LocalParameters. hLoad = mbcloadrecorder( 'current' ); hLoad.add( {@i_UpgradeLocalParameters, address( bdev.xregbdrydev )}, ... '02-Aug-2005' ); % Increment of the version number: bdev.Version = 2; end if isstruct( bdev ), % Convert the structure to an object. bdev = xregbdrydev( bdev ); end %-------------------------------------------------------------------------- function i_UpgradeLocalParameters( pProject, evt, pBdev ) bdev = pBdev.info; % Get the data data = getdata( bdev, 'stage', 'global' ); con = getconstraint( bdev ); if ~isempty(con) % Get the global models gm = getGlobalModels( con ); % Evalauet the global models at the global points for i = 1:length( gm ), bdev.LocalParameters(:,i) = EvalModel( gm{i}, data ); end % Update dynamic version xregpointer( bdev ); end %-------------------------------------------------------------------------- % EOF %--------------------------------------------------------------------------