comparison m-toolbox/classes/@specwin/update_struct.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % UPDATE_STRUCT update the input structure to the current ltpda version
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % FUNCTION: update_struct
5 %
6 % DESCRIPTION: UPDATE_STRUCT update the input structure to the current
7 % ltpda version
8 %
9 % CALL: obj_struct = update_struct(obj_struct, version_str);
10 %
11 % VERSION: $Id: update_struct.m,v 1.7 2011/02/18 16:48:54 ingo Exp $
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 function varargout = update_struct(varargin)
16
17 obj_struct = varargin{1};
18 struct_ver = varargin{2};
19
20 % get the version of the current toolbox
21 tbx_ver = strtok(getappdata(0, 'ltpda_version'));
22
23 % get only the version string without the MATLAB version
24 struct_ver = strtok(struct_ver);
25
26 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.0 -> 1.9.1' %%%%%%%%%%%%%%%%%%%%%%%
27
28 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
29 strcmp(struct_ver, '1.0')
30
31 try
32 if isfield(obj_struct, 'name')
33 obj_struct.type = obj_struct.name;
34 end
35 catch ME
36 disp(varargin{1});
37 throw(addCause(ME, MException('MATLAB:LTPDA','### The struct (specwin) above is not from version 1.0')));
38 end
39
40 struct_ver = '1.9.1';
41 end
42
43 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.1' ->'1.9.2' %%%%%%%%%%%%%%%%%%%%%%%
44
45 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
46 strcmp(struct_ver, '1.9.1')
47
48 struct_ver = '1.9.2';
49 end
50
51 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.2' ->'1.9.3' %%%%%%%%%%%%%%%%%%%%%%%
52
53 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
54 strcmp(struct_ver, '1.9.2')
55
56 struct_ver = '1.9.3';
57 end
58
59 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.3' ->'1.9.4' %%%%%%%%%%%%%%%%%%%%%%%
60
61 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
62 strcmp(struct_ver, '1.9.3')
63
64 struct_ver = '1.9.4';
65 end
66
67 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.4' ->'2.0' %%%%%%%%%%%%%%%%%%%%%%%
68
69 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
70 strcmp(struct_ver, '1.9.4')
71
72 struct_ver = '2.0';
73 end
74
75 %%%%%%%%%%%%%%%%%%%%%%% Update version '2.0' ->'2.0.1' %%%%%%%%%%%%%%%%%%%%%%%
76
77 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
78 strcmp(struct_ver, '2.0')
79
80 struct_ver = '2.0.1';
81 end
82
83 %%%%%%%%%%%%%%%%%%%%%%% Update version '2.0.1' ->'2.1' %%%%%%%%%%%%%%%%%%%%%%%
84
85 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
86 strcmp(struct_ver, '2.0.1')
87
88 struct_ver = '2.1';
89 end
90
91 varargout{1} = obj_struct;
92 end
93