Home > classes > @pzmodel > copy.m

copy

PURPOSE ^

COPY Make copy of pzmodel objects depending of the second input

SYNOPSIS ^

function varargout = copy(varargin)

DESCRIPTION ^

 COPY Make copy of pzmodel objects depending of the second input
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: COPY Make copy of pzmodel objects depending of the second input

 CALL:        objs = copy(objs, [1,0]);

 M-FILE INFO: Get information about this methods by calling
              >> pzmodel.getInfo('copy')

 VERSION:     $Id: copy.m,v 1.6 2008/08/11 09:23:22 hewitson Exp $

 HISTORY:     11-07-2008 Diepholz
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % COPY Make copy of pzmodel objects depending of the second input
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: COPY Make copy of pzmodel objects depending of the second input
0005 %
0006 % CALL:        objs = copy(objs, [1,0]);
0007 %
0008 % M-FILE INFO: Get information about this methods by calling
0009 %              >> pzmodel.getInfo('copy')
0010 %
0011 % VERSION:     $Id: copy.m,v 1.6 2008/08/11 09:23:22 hewitson Exp $
0012 %
0013 % HISTORY:     11-07-2008 Diepholz
0014 %                 Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 function varargout = copy(varargin)
0019 
0020   %%% Check if this is a call for parameters
0021   if utils.helper.isinfocall(varargin{:})
0022     varargout{1} = getInfo(varargin{3});
0023     return
0024   end
0025 
0026   % Collect all pzmodel objects
0027   old = utils.helper.collect_objects(varargin(:), 'pzmodel');
0028   deepcopy = varargin{end};
0029 
0030   if deepcopy
0031     t0   = time;
0032     prov = provenance;
0033     s = size(old);
0034     obj(s(1),s(2)) = pzmodel;
0035     for kk=1:numel(old)
0036       utils.helper.msg(utils.const.msg.OPROC2, 'copying %s', old(kk).name);
0037       obj(kk).gain  = old(kk).gain;
0038       if ~isempty(old(kk).poles)
0039         obj(kk).poles = copy(old(kk).poles,1);
0040       else
0041         obj(kk).poles = [];
0042       end
0043       if ~isempty(old(kk).zeros)
0044         obj(kk).zeros = copy(old(kk).zeros,1);
0045       else
0046         obj(kk).zeros = [];
0047       end
0048       obj(kk).hist  = old(kk).hist;
0049       obj(kk).name  = old(kk).name;
0050       obj(kk).created  = t0;
0051       obj(kk).creator  = prov;
0052       obj(kk).version  = pzmodel.VEROUT;
0053     end
0054   else
0055     obj = old;
0056   end
0057   varargout{1} = obj;
0058 end
0059 
0060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0061 %                               Local Functions                               %
0062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0063 
0064 function ii = getInfo(varargin)
0065   if nargin == 1 && strcmpi(varargin{1}, 'None')
0066     sets = {};
0067     pl   = [];
0068   else
0069     sets = {'Default'};
0070     pl   = getDefaultPlist;
0071   end
0072   % Build info object
0073   ii = minfo(mfilename, 'pzmodel', '', 'Internal', '$Id: copy.m,v 1.6 2008/08/11 09:23:22 hewitson Exp $', sets, pl);
0074 end
0075 
0076 function plo = getDefaultPlist()
0077   plo = plist();
0078 end
0079

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