Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@time/update_struct.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,47 @@ +% UPDATE_STRUCT update the input structure to the current ltpda version +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% FUNCTION: update_struct +% +% DESCRIPTION: UPDATE_STRUCT update the input structure to the current +% ltpda version +% +% CALL: obj_struct = update_struct(obj_struct, version_str); +% +% VERSION: $Id: update_struct.m,v 1.12 2010/08/02 16:41:10 nicolodi Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function obj_struct = update_struct(obj_struct, version_str) + + % get only the version string without the MATLAB version and convert to double + ver = utils.helper.ver2num(strtok(version_str)); + + % update from version 1.0 + if ver <= utils.helper.ver2num('1.0') + if isfield(obj_struct, 'timeformat') + if isstruct(obj_struct.timeformat) + obj_struct.timeformat = obj_struct.timeformat.format_str; + end + end + end + + % update from version 2.3 + if ver <= utils.helper.ver2num('2.3') + if isfield(obj_struct, 'time_str') + obj_struct = rmfield(obj_struct, 'time_str'); + end + end + + % update from version 2.4 + if ver <= utils.helper.ver2num('2.4') + if isfield(obj_struct, 'timeformat') + obj_struct = rmfield(obj_struct, 'timeformat'); + end + if isfield(obj_struct, 'timezone') + obj_struct = rmfield(obj_struct, 'timezone'); + end + end + +end +