function h = event(name, time)
%EVENT Construct an event object for a time series
%
%   E=TSDATA.EVENT('NAME',TIME) creates an event object called NAME with an
%   event occuring at the time given in TIME. Add this event object to a
%   time series object with ADDEVENT.
%
%   The event object has the following properties:
%     EventData: user-defined information about the event
%     Name: a string defining the name of the event
%     Time: an integer giving the time of the event
%     Parent: the time series object that the event is associated with
%
%   See also TSDATA.TIMESERIES/TIMESERIES, TSDATA.TIMESERIES/ADDEVENT

%   Authors: James G. Owen
%   Copyright 1986-2003 The MathWorks, Inc.
%   $Revision: 1.1.6.1 $  $Date: 2004/12/26 21:34:17 $

%% Create the object
h = tsdata.event;
if nargin==0
    return
end

%% Set the name
if ischar(name)
    h.Name = name;
else
    error('The event name must be specified by the first argument')
end

if isnumeric(time) && length(time)==1 && nargin>=2
    h.Time = time;
else
    error('Time must be specified as a numeric scalar value')
end