


UPDATE_STRUCT update the input structure to the current ltpda version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION: update_struct
DESCRIPTION: UPDATE_STRUCT update the input structure to the current
ltpda version
CALL: [obj_struct, obj_class] = update_struct(obj_struct, version_str);
VERSION: $Id: update_struct.m,v 1.2 2008/09/05 14:16:11 hewitson Exp $
HISTORY: 07-07-2008 Diepholz
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0001 % UPDATE_STRUCT update the input structure to the current ltpda version 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % FUNCTION: update_struct 0005 % 0006 % DESCRIPTION: UPDATE_STRUCT update the input structure to the current 0007 % ltpda version 0008 % 0009 % CALL: [obj_struct, obj_class] = update_struct(obj_struct, version_str); 0010 % 0011 % VERSION: $Id: update_struct.m,v 1.2 2008/09/05 14:16:11 hewitson Exp $ 0012 % 0013 % HISTORY: 07-07-2008 Diepholz 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 function varargout = update_struct(varargin) 0019 0020 obj_struct = varargin{1}; 0021 struct_ver = varargin{2}; 0022 0023 % get the version of the current toolbox 0024 tbx_ver = strtok(getappdata(0, 'ltpda_version')); 0025 0026 % get only the version string without the MATLAB version 0027 struct_ver = strtok(struct_ver); 0028 0029 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.0 -> 1.9.1' %%%%%%%%%%%%%%%%%%%%%%% 0030 0031 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ... 0032 strcmp(struct_ver, '1.0') 0033 0034 try 0035 0036 obj_struct = rmfield(obj_struct, 'name'); 0037 0038 catch ME 0039 disp(varargin{1}); 0040 throw(addCause(ME, MException('MATLAB:LTPDA','### The struct (cdata) above is not from version 1.0'))); 0041 end 0042 0043 % Set the struct_ver to '1.9.1' 0044 struct_ver = '1.9.1'; 0045 0046 end 0047 0048 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.1' ->'1.9.2' %%%%%%%%%%%%%%%%%%%%%%% 0049 0050 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ... 0051 strcmp(struct_ver, '1.9.1') 0052 0053 % Check Y units 0054 try 0055 uo = unit(obj_struct.yunits); 0056 catch 0057 warning('!!! This XML file contains a fsdata object with unsupported y-units [%s]. Setting to empty.', obj_struct.yunits); 0058 obj_struct.yunits = ''; 0059 end 0060 0061 % Check X units 0062 try 0063 uo = unit(obj_struct.xunits); 0064 catch 0065 warning('!!! This XML file contains a fsdata object with unsupported x-units [%s]. Setting to empty.', obj_struct.xunits); 0066 obj_struct.xunits = ''; 0067 end 0068 0069 % Set the struct_ver to '1.9.2' 0070 struct_ver = '1.9.2'; 0071 0072 end 0073 0074 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.2' ->'1.9.3' %%%%%%%%%%%%%%%%%%%%%%% 0075 0076 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ... 0077 strcmp(struct_ver, '1.9.2') 0078 0079 % Set the struct_ver to '1.9.3' 0080 struct_ver = '1.9.3'; 0081 0082 end 0083 0084 varargout{1} = obj_struct; 0085