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