function s = saveobj(h)
% LOADOBJ Overload save command

%   Author(s): James G. Owen, Rong Chen
%   Copyright 1986-2004 The MathWorks, Inc.
%   $Revision: 1.1.6.1 $  $Date: 2004/12/26 21:35:55 $

% copy the object h into a struct s
c = classhandle(h);
for k=1:length(c.Properties)
    if strcmp(c.Properties(k).AccessFlags.Serialize,'on')
       if isa(c.Properties(k),'tsdata.timeseriesArray')
           s.(c.Properties(k).Name) = c.Properties(k).copy;
       elseif isa(c.Properties(k),'tsdata.timemetadata')
           s.(c.Properties(k).Name) = c.Properties(k).copy;
       else
           s.(c.Properties(k).Name) = get(h,c.Properties(k).Name);
       end
    end
end
props = fields(get(h));
ind = 1;
for k=1:length(props)
    if isa(h.(props{k}),'tsdata.timeseries')
        s.(props{k}) = h.(props{k}).copy;
    end
end

