Mercurial > hg > ltpda
comparison m-toolbox/classes/@time/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 2010/08/02 16:41:10 nicolodi Exp $ | |
12 % | |
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
14 | |
15 function obj_struct = update_struct(obj_struct, version_str) | |
16 | |
17 % get only the version string without the MATLAB version and convert to double | |
18 ver = utils.helper.ver2num(strtok(version_str)); | |
19 | |
20 % update from version 1.0 | |
21 if ver <= utils.helper.ver2num('1.0') | |
22 if isfield(obj_struct, 'timeformat') | |
23 if isstruct(obj_struct.timeformat) | |
24 obj_struct.timeformat = obj_struct.timeformat.format_str; | |
25 end | |
26 end | |
27 end | |
28 | |
29 % update from version 2.3 | |
30 if ver <= utils.helper.ver2num('2.3') | |
31 if isfield(obj_struct, 'time_str') | |
32 obj_struct = rmfield(obj_struct, 'time_str'); | |
33 end | |
34 end | |
35 | |
36 % update from version 2.4 | |
37 if ver <= utils.helper.ver2num('2.4') | |
38 if isfield(obj_struct, 'timeformat') | |
39 obj_struct = rmfield(obj_struct, 'timeformat'); | |
40 end | |
41 if isfield(obj_struct, 'timezone') | |
42 obj_struct = rmfield(obj_struct, 'timezone'); | |
43 end | |
44 end | |
45 | |
46 end | |
47 |