Home > classes > @tsdata > 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/05 14:07:54 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.2 2008/08/05 14:07:54 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       obj_struct = rmfield(obj_struct, 'name');
0036       obj_struct = rmfield(obj_struct, 'created');
0037 
0038       if isempty(obj_struct.fs)
0039         obj_struct.fs = NaN;
0040       end
0041 
0042     catch ME
0043       disp(varargin{1});
0044       throw(addCause(ME, MException('MATLAB:LTPDA','### The struct (fsdata) above is not from version 1.0')));
0045     end
0046 
0047     % Set the struct_ver to '1.1'
0048     struct_ver = '1.1';
0049 
0050   end
0051 
0052   %%%%%%%%%%%%%%%%%%%%%%%   Update version '1.1' ->'1.2'  %%%%%%%%%%%%%%%%%%%%%%%
0053 
0054   if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0055       strcmp(struct_ver, '1.1')
0056 
0057     % Set the struct_ver to '1.2'
0058     struct_ver = '1.1';
0059 
0060   end
0061 
0062   %%%%%%%%%%%%%%%%%%%%%%%   Update version '1.2' ->'1.3'  %%%%%%%%%%%%%%%%%%%%%%%
0063 
0064   if utils.helper.ver2num(struct_ver) < utils.helper.ver2num(tbx_ver) && ...
0065       strcmp(struct_ver, '1.2')
0066 
0067     % Set the struct_ver to '1.3'
0068     struct_ver = '1.3';
0069 
0070   end
0071 
0072   varargout{1} = obj_struct;
0073 end
0074 
0075

Generated on Mon 25-Aug-2008 22:39:29 by m2html © 2003