function gsrStruct=applySCLWindow(gsrStruct, startWindow, finishWindow, sectosamp)
%This function simply sets the values of riseWave to either 1 or 0 based on
%the desired SCL analysis window set in the Autonomate GUI.

%Convert startWindow and finishWindow to samples, rather than seconds
startIndex = round(sectosamp * startWindow);
finishIndex = round(sectosamp * finishWindow);

for e=1:length(gsrStruct.Event) %for each event
    
    %Set the riseWave to 1 between the startWindow and finishWindow.
    %The current riseWave values are designated by the slope of the
    %corresponding raw data points, which we don't care about in SCL
    %analysis.
    final_iteration = size(gsrStruct.Event(e).Iteration,2);
    gsrStruct.Event(e).Iteration(final_iteration).riseWave(:) = 0;
    if startIndex == 0
        startIndex = 1;
    end
    if finishIndex == 0
        finishIndex = 1;
    end
    gsrStruct.Event(e).Iteration(final_iteration).riseWave(startIndex:finishIndex) = 1;
    
    %Make sure all events are set to 'active'.
    for u = 1:size(gsrStruct.Event(e).Iteration(final_iteration).Ups,2)
        gsrStruct.Event(e).Iteration(final_iteration).Ups(u).Status = 'active';
    end

end
