view m-toolbox/classes/@ssm/copy.m @ 36:5eb86f6881ef database-connection-manager

Remove commented-out code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% COPY Make copy of ssm objects depending of the second input
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: COPY Make copy of ssm objects depending of the second input
%
% CALL:        objs = copy(objs, [1,0]);
%              objs = copy(objs); Second input is assumed to be 1
%
%  This is a transparent function and adds no history.
% 
% VERSION: $Id: copy.m,v 1.30 2010/08/18 19:40:52 adrien Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% HISTORY:     07-08-2008 Grynagier - made second input facultative
%              11-07-2008 Diepholz
%                 Creation

function varargout = copy(old, deepcopy)
  
  % begin function body
  
  if deepcopy
    new = ssm.newarray(size(old));
    new = copy@ltpda_uoh(new, old, 1);

    for kk=1:numel(old)
      new(kk).amats       = old(kk).amats;
      new(kk).bmats       = old(kk).bmats;
      new(kk).cmats       = old(kk).cmats;
      new(kk).dmats       = old(kk).dmats;
      new(kk).timestep    = old(kk).timestep;
      new(kk).inputs      = copy(old(kk).inputs, 1);
      new(kk).states      = copy(old(kk).states, 1);
      new(kk).outputs     = copy(old(kk).outputs, 1);
      new(kk).params      = copy(old(kk).params, 1);
      new(kk).numparams   = copy(old(kk).numparams, 1);
    end
  else
    new = old;
  end
  varargout{1} = new;
  
end