% method of class @signal
% function sig=buildspikesfrompoints(sig,xx,yy)
% calculates a @signal from the points in x and y
% the new signal is zero everywhere except from the points in xx
%
%   INPUT VALUES:
%       sig:  original @signal
%       xx: x-values of points
%       yy: y-values of points
%    
%   RETURN VALUE:
%       sig: new @signal 
%
% (c) 2003-2008, University of Cambridge, Medical Research Council 
% Maintained by Tom Walters (tcw24@cam.ac.uk), written by Stefan Bleeck (stefan@bleeck.de)
% http://www.pdn.cam.ac.uk/cnbh/aim2006
% $Date: 2008-06-10 18:00:16 +0100 (Tue, 10 Jun 2008) $
% $Revision: 585 $

function sig=buildspikesfrompoints(sig,xx,yy)
% uage: sig=buildspikesfrompoints(sig,xx,yy)
% makes a dot of the hight given in yy at each point given in xx
% all other values =0


sig=mute(sig);

nr_points=length(xx);
for i=1:nr_points
    oldval=gettimevalue(sig,xx(i));
    newval=oldval+yy(i);
    sig=addtimevalue(sig,xx(i),newval);
end


