% clear the memory clear; % close all open files and windows close all; % clear the command console clc; % key file variables we will need pathName = '/Users/krigolson/Desktop/tutorialData'; fileName = 'Oddball1.vhdr'; % load the data EEG = doLoadBVData(pathName,fileName); % keep track of the original channel locations originalChannels = EEG.chanlocs; % define the filter parameters filterParameters.low = 0.5; filterParameters.high = 30; filterParameters.notch = 60; % filter the data EEG = doFilter(EEG,filterParameters); % do some initial data cleaning EEG = doCleanData(EEG); % rereference the data to the average reference before ICA to improve % results EEG = doICAReference(EEG); % run the ICA EEG = doICA(EEG); % remove ocular ICA components EEG = doRemoveOcularICAComponents(EEG); % interpolate the removed channels EEG = doInterpolate(EEG,originalChannels); % rereference the data EEG = doRereference(EEG,{'TP9' 'TP10'},{'ALL'}); % epoch the data into segments epochMarkers = {'S202','S203'}; epochTimes = [-0.2 0.6]; EEG = doEpochData(EEG,epochMarkers,epochTimes); % baseline correct the data baselineWindow = [-0.2 0]; EEG = doBaseline(EEG,baselineWindow); % make ERPS ERP = doERP(EEG,epochMarkers); % let's plot the P300, we will use channel Pz erpChannel = 52; % Pz plot(ERP.times,ERP.data(erpChannel,:,1)); hold on; plot(ERP.times,ERP.data(erpChannel,:,2)); % save the data save('Subject 1','ERP')