function hout = copy(h, varargin)
%COPY  Perform a deep copy of the time series object
%
%   COPY(TS) creates a copy of the time series object TS and assigns it a 
%   default name
%   COPY(TS,'NAME') creates a copy of the time series object TS and assigns
%   it the name given by the string 'NAME' 
% 
%   Note: The command TS2=TS1, where TS1 and TS2 are time series objects, 
%   does not create a copy of TS1 but creates a pointer to TS1. In this 
%   case any changes made to TS2 will also be made to TS1. 
%
%   See also TSDATA.TIMESERIES/TIMESERIES

%   Author(s): James G. Owen
%   Copyright 1986-2003 The MathWorks, Inc. 
%   $Revision: 1.1.6.1 $  $Date: 2004/12/26 21:34:57 $

%UDD deep copy

hout = tsdata.timeseries;
utdeepcopy(h,hout);

if nargin>1
    hout.Name = varargin{1};
end
