comparison m-toolbox/classes/@minfo/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.9 2011/02/18 16:48:53 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
33 catch ME
34 disp(varargin{1});
35 throw(addCause(ME, MException('MATLAB:LTPDA','### The struct (minfo) above is not from version 1.0')));
36 end
37
38 struct_ver = '1.9.1';
39 end
40
41 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.1' ->'1.9.2' %%%%%%%%%%%%%%%%%%%%%%%
42
43 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
44 strcmp(struct_ver, '1.9.1')
45
46 struct_ver = '1.9.2';
47 end
48
49 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.2' ->'1.9.3' %%%%%%%%%%%%%%%%%%%%%%%
50
51 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
52 strcmp(struct_ver, '1.9.2')
53
54 %%% optimization_version
55 if ~isfield(obj_struct, 'modifier')
56 obj_struct.modifier = false;
57 end
58
59 struct_ver = '1.9.3';
60 end
61
62 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.3' ->'1.9.4' %%%%%%%%%%%%%%%%%%%%%%%
63
64 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
65 strcmp(struct_ver, '1.9.3')
66
67 %%% modifier
68 if ~isfield(obj_struct, 'modifier')
69 obj_struct.modifier = false;
70 end
71
72 struct_ver = '1.9.4';
73 end
74
75 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.4' ->'2.0' %%%%%%%%%%%%%%%%%%%%%%%
76
77 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
78 strcmp(struct_ver, '1.9.4')
79
80 struct_ver = '2.0';
81 end
82
83 %%%%%%%%%%%%%%%%%%%%%%% Update version '2.0' ->'2.0.1' %%%%%%%%%%%%%%%%%%%%%%%
84
85 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
86 strcmp(struct_ver, '2.0')
87
88 struct_ver = '2.0.1';
89 end
90
91 %%%%%%%%%%%%%%%%%%%%%%% Update version '2.0.1' ->'2.1' %%%%%%%%%%%%%%%%%%%%%%%
92
93 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
94 strcmp(struct_ver, '2.0.1')
95
96 struct_ver = '2.1';
97 end
98
99 varargout{1} = obj_struct;
100 end
101