function update(h,tsNames,varargin)

%% Refresh the list of timeseries in the tslist to agree with
%% the time series nodes in the viewer. The optional 3rd arg specifies a
%% a time series name in the list which should be intially selected

%% Has a particular time series been selected?
ind = [];
if nargin>=3
    ind = find(strcmp(varargin{1},tsNames));
elseif length(tsNames)>0
    ind = 1;
end

if ~isempty(ind)
    set(h.Handles.tsList,'String',tsNames(:),'Value',ind);
else
    set(h.Handles.tsList,'String','','Value',1)
end