Install the main matlab package, simulink, and statistics & machine learning package
EEGLAB
Move the eeglab2024 folder to User > Documents > MATLAB
Data Prep
I. Upload EEG Data
Download a subject's dataset from Sharepoint
In your MATLAB folder, create a folder for EEG data
Download the subject's .mff files for pitch and duration
Create a folder for each subject's .mff files
Add each subject folder to your EEG data folder
Open MATLAB
Make sure youâre in Documents > MATLAB
Right click on the eeglab2024 folder > add to path > select folders and subfolders
Type âeeglabâ into the command window and hit enter
Import the subject's data
Select File > Import data > Using eeg lab functions & plugins > Import magstim/EGI.mff file
Navigate the directory to open the subject's .mff file
Select code > Ok
II. Pre-Process Data
Change the sampling rate
Select Tools > Change sampling rate > 250
Nyquist Rule: you can only analyze frequencies that are half of the sampling rate
We only care about frequencies between 0-20
Rename the data set
Rename the file by deleting all characters behind either âpâ or âd" and add "resampled" > Ok
Re-reference the data
Select Tools > Re-reference the data
Select Re-reference data to channel(s) > "..." > E65 > Ok
Rename the data set
Rename the file by adding "rerf" to the end (ex: 19000X resampled rerf) > Ok
Filter the data
Select Tools > Filter the data > Basic FIR filter
Set the lower edge as 0.5 and the higher edge as 30
Deselect plot frequency > Ok
Save as a new dataset
Rename the file by adding "filter" to the end (ex: 19000x resampled reref filter)
Select Save it as file > Browse
Add the file name and save it in the subject's EEG data folder
Select Save > Ok
Data prep only needs to be done once for each dataset (but only if you save it!)
Scroll & Scrub
III. Select EEG Dataset
Open MATLAB
Make sure youâre in Documents > MATLAB
Right click on the eeglab2024 folder > add to path > select folders and subfolders
Type âeeglabâ into the command window and hit enter
Import the subject's data
Select File > Load existing dataset
Navigate the directory to open the subject's "resampled reref filter" file
Select code > Ok
IV. View data
Select Plot > Channel data (scroll)
In the plot window, select Settings > Time range display > 60 > Ok
Select Display > Remove DC offset
Select Display > Normalize channels
Decrease the lower amplitude to 1 > continue to decrease until EGG details are clear and channels are discriminable
V. Clean data
Scroll through the data and highlight all unpredicted noise
Avoid deleting data right after tone 1 and tone 2; that's what we're most interested in
Once all noise is highlighted, select reject
Rename the file replacing "resampled reref filter" with "clean" (ex: 19000x clean)
XXXXXXXXXXXXXXXXXXXXXXXXXXXX
2b. Independent Component Analysis
noise: repeated noise (blinking) â> ICA electrical noise â> filtered out in beginning bad electrode â> doesnât matter how much you remove, so note any electrodes that look weird unpredicted noise - when participant moves around or clenches jaw excessively
run ICA â neural network â tools â> decompose by ICA â
click on channels â highlight all channels from 1-60 â deselect electrodes we wrote down for being problematic by clicking on them while pressing command on your keyboard
ICA neural net will start learning
tools â> inspect/label components by map
prompt with how many components to show.
# components = # channels input into algorithm (degrees of freedom)
â maps tell you where noise patterns and occurring
â checkerboard is bad
â organizes data based on sources of most noise
â most important are in first two rows
â color map is most important
â long streaks = eye movement
â v
maps tell you where noise is occurring
brain data looks like fuzzy tv
to reject: - go through components with streaks or electrode popping and accept then click ok
tools â> remove components by data â> yes â> plot single trials - time range = 60 â normalize â if the red lines look different enough from the black lines â> click accept then ok
bad electrodes interpolation
â tools â> interpolate electrodes â> select from data channels â> select removed electrodes from before (not 61-64)
â add âintâ to end of name and click ok
â tools â> extract epochs â> 3 dots â> select time 1 and time 2
â epoch limits change to -0.1 0.5
â tools â> remove epoch baseline â> click ok
plot â> channel ERP image â> type all relevant channels into channels box and click ok â click on blue line graph to open