comparison m-toolbox/classes/@rational/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.4 2009/08/31 17:11:22 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 struct_ver = '1.9.1';
32 end
33
34 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.1' ->'1.9.2' %%%%%%%%%%%%%%%%%%%%%%%
35
36 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
37 strcmp(struct_ver, '1.9.1')
38
39 struct_ver = '1.9.2';
40 end
41
42 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.2' ->'1.9.3' %%%%%%%%%%%%%%%%%%%%%%%
43
44 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
45 strcmp(struct_ver, '1.9.2')
46
47 struct_ver = '1.9.3';
48 end
49
50 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.3' ->'1.9.4' %%%%%%%%%%%%%%%%%%%%%%%
51
52 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
53 strcmp(struct_ver, '1.9.3')
54
55 %%% created
56 if isfield(obj_struct, 'created')
57 obj_struct = rmfield(obj_struct, 'created');
58 end
59
60 %%% creator
61 if isfield(obj_struct, 'creator')
62 obj_struct = rmfield(obj_struct, 'creator');
63 end
64
65 struct_ver = '1.9.4';
66 end
67
68 %%%%%%%%%%%%%%%%%%%%%%% Update version '1.9.4' ->'2.0' %%%%%%%%%%%%%%%%%%%%%%%
69
70 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
71 strcmp(struct_ver, '1.9.4')
72
73 struct_ver = '2.0';
74 end
75
76 %%%%%%%%%%%%%%%%%%%%%%% Update version '2.0' ->'2.0.1' %%%%%%%%%%%%%%%%%%%%%%%
77
78 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
79 strcmp(struct_ver, '2.0')
80
81 struct_ver = '2.0.1';
82 end
83
84 %%%%%%%%%%%%%%%%%%%%%%% Update version '2.0.1' ->'2.1' %%%%%%%%%%%%%%%%%%%%%%%
85
86 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
87 strcmp(struct_ver, '2.0.1')
88
89 struct_ver = '2.1';
90 end
91
92 varargout{1} = obj_struct;
93 end
94