function removets(h, tsname)
%REMOVETS Remove a time series object from the tscollection object
%
% REMOVETS(TSC,X) removes the time series object with the name of X from
% the tscollection TSC.

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

if ~ischar(tsname)
    error('Time series to be removed must be referenced by their name')
end
memberVars=h.getMembers;
I = strcmp(strtrim(tsname),memberVars);
if ~any(I)
    error('Member time series not found')
else
    delete(get(h,tsname));
    delete(findprop(h,tsname));
    delete(h.Listeners_.(tsname));
end
