function w=convert_IPIs_into_timewindows(IPIs,startpoint,samples_per_ms,window_following_final_pulse)
%description: Returns the time of each AP onset in a trial and the time of the end of a window following the final pulse.
%called by: cluster_asynch_based_on_phasic, temporary_asynch_analyzer(deprecated)
%calls: [no custom functions]
%notes: IPIs are expected to be row-wise, with a separate column for each trial.  Used with expts that have the first IPI and third IPI fixed at 50 ms.
%code confirm date: sep 19, 2009

w=[IPIs;repmat(50,1,size(IPIs,2))];   %the storage convention omitted this third IPI value (50 ms)
w=[w;repmat(window_following_final_pulse,1,size(w,2))];
w=w*samples_per_ms;
w=cumsum(w);
w=w+startpoint;
w=[repmat(startpoint,1,size(w,2));w];