Home > classes > @mfir > 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.1 2008/07/10 12:06:49 ingo 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.1 2008/07/10 12:06:49 ingo Exp $
0012 %
0013 % HISTORY:     07-07-2008 Diepholz
0014 %                 Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 function varargout = update_struct(varargin)
0019 
0020 obj_struct = varargin{1};
0021 struct_ver = varargin{2};
0022 
0023 % get the version of the current toolbox
0024 tbx_ver = strtok(getappdata(0, 'ltpda_version'));
0025 
0026 % get only the version string without the MATLAB version
0027 struct_ver = strtok(struct_ver);
0028 
0029 %%%%%%%%%%%%%%%%%%%%%%%   Update version '1.0 -> 1.1'   %%%%%%%%%%%%%%%%%%%%%%%
0030 
0031 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0032     strcmp(struct_ver, '1.0')
0033 
0034   try
0035 
0036     if ~isempty(obj_struct.gain) && obj_struct.gain ~= 0
0037       obj_struct.a = obj_struct.a * obj_struct.gain;
0038       obj_struct = rmfield(obj_struct, 'gain');
0039     end
0040 
0041     if isempty(obj_struct.plist)
0042       obj_struct.plist = plist();
0043     end
0044     ii = minfo('update_struct', 'mfir', '', '', ...
0045                '$Id: update_struct.m,v 1.1 2008/07/10 12:06:49 ingo Exp $', ...
0046                {'Default'}, plist(), 0, 0);
0047     obj_struct.hist = history(time().utc_epoch_milli, ii, obj_struct.plist);
0048     obj_struct = rmfield(obj_struct, 'plist');
0049 
0050     obj_struct.creator = provenance('Updater 1.0 -> 1.1');
0051     obj_struct.gd      = 0;
0052 
0053   catch ME
0054     disp(varargin{1});
0055     throw(addCause(ME, MException('MATLAB:LTPDA','### The struct (mfir) above is not from version 1.0')));
0056   end
0057 
0058   % Set the struct_ver to '1.1'
0059   struct_ver = '1.1';
0060 
0061 end
0062 
0063 %%%%%%%%%%%%%%%%%%%%%%%   Update version '1.1' ->'1.2'  %%%%%%%%%%%%%%%%%%%%%%%
0064 
0065 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0066     strcmp(struct_ver, '1.1')
0067 
0068   % Set the struct_ver to '1.2'
0069   struct_ver = '1.1';
0070 
0071 end
0072 
0073 %%%%%%%%%%%%%%%%%%%%%%%   Update version '1.2' ->'1.3'  %%%%%%%%%%%%%%%%%%%%%%%
0074 
0075 if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0076     strcmp(struct_ver, '1.2')
0077 
0078   % Set the struct_ver to '1.3'
0079   struct_ver = '1.3';
0080 
0081 end
0082 
0083 varargout{1} = obj_struct;
0084

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