function [outData] = demean(inData) %DEMEAN performs baseline correction using the given time window % input stream is divided into trials and average voltage within the set % time window is calculated for each trial. Afterwards this average % activity is subtracted from the whole trial to normalise activity in % set time window to 0. % calculate average voltage within time window avV = mean(inData); % subtract average voltage from trials outData = inData-avV; end