0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 function varargout = update_struct(varargin)
0019
0020 obj_struct = varargin{1};
0021 struct_ver = varargin{2};
0022
0023
0024 tbx_ver = strtok(getappdata(0, 'ltpda_version'));
0025
0026
0027 struct_ver = strtok(struct_ver);
0028
0029
0030
0031 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0032 strcmp(struct_ver, '1.0')
0033
0034 try
0035 obj_struct = rmfield(obj_struct, 'name');
0036 obj_struct = rmfield(obj_struct, 'created');
0037 obj_struct.t0 = time(0);
0038
0039 if isempty(obj_struct.navs)
0040 obj_struct.navs = NaN;
0041 end
0042
0043 if isempty(obj_struct.fs)
0044 obj_struct.fs = NaN;
0045 end
0046
0047 if isempty(obj_struct.enbw)
0048 obj_struct.enbw = NaN;
0049 end
0050
0051
0052 catch ME
0053 disp(varargin{1});
0054 throw(addCause(ME, MException('MATLAB:LTPDA','### The struct (fsdata) above is not from version 1.0')));
0055 end
0056
0057
0058 struct_ver = '1.9.1';
0059
0060 end
0061
0062
0063
0064 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0065 strcmp(struct_ver, '1.9.1')
0066
0067
0068 obj_struct.xunits = char(obj_struct.xunits);
0069 obj_struct.yunits = char(obj_struct.yunits);
0070
0071
0072
0073
0074 obj_struct.xunits = strrep(obj_struct.xunits, '/\surdHz', ' Hz^-0.5');
0075 obj_struct.yunits = strrep(obj_struct.yunits, '/\surdHz', ' Hz^-0.5');
0076
0077
0078 try
0079 uo = unit(obj_struct.yunits);
0080 catch
0081 warning('!!! This XML file contains a fsdata object with unsupported y-units [%s]. Setting to empty.', obj_struct.yunits);
0082 obj_struct.yunits = '';
0083 end
0084
0085
0086 try
0087 uo = unit(obj_struct.xunits);
0088 catch
0089 warning('!!! This XML file contains a fsdata object with unsupported x-units [%s]. Setting to empty.', obj_struct.xunits);
0090 obj_struct.xunits = '';
0091 end
0092
0093 struct_ver = '1.9.1';
0094
0095 end
0096
0097
0098
0099 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0100 strcmp(struct_ver, '1.9.2')
0101
0102
0103 struct_ver = '1.9.3';
0104
0105 end
0106
0107 varargout{1} = obj_struct;
0108 end
0109