www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@sweepset/loadobj.m
function obj = loadobj(objIn) %LOADOBJ Load sweepset object % % OBJ = LOADOBJ(OBJ) executes load-time upgrade actions for the object. % Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc. obj = objIn; % Enter code for updating object in this case statement if obj.version<2 obj = i_V1toV2(obj); end if obj.version<3 obj = i_V2toV3(obj); end if obj.version<4 % Remove nrec and nvar fields; they are now derived from data as needed obj = rmfield(obj, 'nrec'); obj = rmfield(obj, 'nvar'); obj.version = 4; end if obj.version<5 for i=1:length(obj.var) obj.var(i).units = char(obj.var(i).units); end obj.version = 5; end % Might need to recreate the actual object class if isstruct(obj) % Get the parent object parent = obj.xregdataset; % Remove from the field list obj = rmfield(obj, 'xregdataset'); % Recreate the class obj = sweepset('struct', obj, parent); end % -------------------------------------------------------------------- % Convert version 1 sweepsets to version 2 % -------------------------------------------------------------------- function obj = i_V1toV2(obj) obj.version = 2; % No longer convert to junits % -------------------------------------------------------------------- % Convert version 2 sweepsets to version 3 % -------------------------------------------------------------------- function obj = i_V2toV3(obj) obj.version = 3; % Need to add a guidarray to uniquely identify each record obj.guid = guidarray(size(obj.data, 1)); % Copy the number field into the filename field obj.filename = obj.number;