Home > classes > @ssm > update_struct.m

update_struct

PURPOSE ^

UPDATE_STRUCT update the input structure to the current ltpda version

SYNOPSIS ^

function varargout = update_struct(varargin)

DESCRIPTION ^

 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.2 2008/08/08 15:32:33 adrien Exp $

 HISTORY:     07-07-2008 Diepholz
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % UPDATE_STRUCT update the input structure to the current ltpda version
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % FUNCTION:    update_struct
0005 %
0006 % DESCRIPTION: UPDATE_STRUCT update the input structure to the current
0007 %              ltpda version
0008 %
0009 % CALL:        obj_struct = update_struct(obj_struct, version_str);
0010 %
0011 % VERSION:     $Id: update_struct.m,v 1.2 2008/08/08 15:32:33 adrien Exp $
0012 %
0013 % HISTORY:     07-07-2008 Diepholz
0014 %                 Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 function varargout = update_struct(varargin)
0019 utils.helper.msg(utils.const.msg.MNAME, ['running ', mfilename]);
0020 
0021 obj_struct = varargin{1};
0022 struct_ver = varargin{2};
0023 
0024 % get the version of the current toolbox
0025 tbx_ver = strtok(getappdata(0, 'ltpda_version'));
0026 
0027 % get only the version string without the MATLAB version
0028 struct_ver = strtok(struct_ver);
0029 
0030 %%%%%%%%%%%%%%%%%%%%%%%   Update version '1.0 -> 1.1'   %%%%%%%%%%%%%%%%%%%%%%%
0031 
0032 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0033     strcmp(struct_ver, '1.0')
0034 
0035   try
0036 
0037     % Update here the structure
0038 
0039   catch ME
0040     disp(varargin{1});
0041     throw(addCause(ME, MException('MATLAB:LTPDA','### The struct (ssm) above is not from version 1.0')));
0042   end
0043 
0044   % Set the struct_ver to '1.1'
0045   struct_ver = '1.1';
0046 
0047 end
0048 
0049 %%%%%%%%%%%%%%%%%%%%%%%   Update version '1.1' ->'1.2'  %%%%%%%%%%%%%%%%%%%%%%%
0050 
0051 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0052     strcmp(struct_ver, '1.1')
0053 
0054   % Set the struct_ver to '1.2'
0055   struct_ver = '1.1';
0056 
0057 end
0058 
0059 %%%%%%%%%%%%%%%%%%%%%%%   Update version '1.2' ->'1.3'  %%%%%%%%%%%%%%%%%%%%%%%
0060 
0061 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0062     strcmp(struct_ver, '1.2')
0063 
0064   % Set the struct_ver to '1.3'
0065   struct_ver = '1.3';
0066 
0067 end
0068 
0069 varargout{1} = obj_struct;
0070

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003