Simply EEGLAB
Exporting results for papers & stats software
Station 8 · Lesson 8 · EEGLAB 2026.1
In the GUI
- StudyPlot channel measuresSelect design:
image onlyPz - ParamsPlot ERPsTime range (ms) [low high]OkPlot ERPs
150 250
Script
names = {STUDY.changrp.name};
chans = names(ismember(lower(names), {'fz', 'pz'}));
win = [150 250]; % window fixed before looking at the data (Thorpe et al., 1996)
d = 3; % design 'image only': every participant appears in both conditions
subjects = STUDY.design(d).cases.value;
conds = STUDY.design(d).variable(1).value;
rows = {};
for c = 1:numel(chans)
[STUDY, erp, times] = std_readdata(STUDY, ALLEEG, 'channels', chans(c), 'design', d, 'datatype', 'erp');
inWin = times >= win(1) & times <= win(2);
for k = 1:numel(conds)
if size(erp{k}, 2) ~= numel(subjects)
error('Condition %s does not hold every participant', conds{k});
end
amp = mean(erp{k}(inWin, :), 1); % one mean amplitude per participant
for s = 1:numel(subjects)
info = STUDY.datasetinfo(strcmp({STUDY.datasetinfo.subject}, subjects{s}));
rows(end+1, :) = {subjects{s}, info(1).group, conds{k}, chans{c}, double(amp(s))};
end
end
end
T = cell2table(rows, 'VariableNames', {'subject', 'gender', 'condition', 'channel', 'mean_uV'});
csvFile = fullfile(studyDir, 'erp_150_250_mean.csv');
writetable(T, csvFile);
fprintf('%d rows written to %s\n', height(T), csvFile);
disp(T(1:4, :));
for k = 1:numel(conds)
sel = strcmpi(T.channel, 'Pz') & strcmp(T.condition, conds{k});
fprintf('Pz %s: mean %.2f uV over %d participants\n', conds{k}, mean(T.mean_uV(sel)), nnz(sel));
endWhich value should I choose?
| Choice | In this lesson | When to change it |
|---|---|---|
| Measure | Mean amplitude in a window | Peak amplitude and latency are noisier for single participants. If you need them, see the ERPLAB amplitude and latency lesson. |
| Window | 150 to 250 ms: the start from Thorpe et al. (1996), the end a choice for this lesson | From your question or earlier studies, fixed before you look. Never from the group plot of the same data. |
| Channels | Fz and Pz | The channels named in your hypothesis. Averaging a few neighboring channels gives a more stable value than one channel. |
| Design | 3, all participants in both conditions | Any design, but then each cell holds only some participants: setinds (the seventh output of std_readdata) gives the dataset numbers in each cell, and the participant names are in STUDY.datasetinfo(setinds{c}).subject. |
| Format | CSV, long format | Wide format for SPSS. Use writetable(T, 'file.xlsx') if you need Excel. |
For your Methods
For each participant and image category, the mean ERP amplitude from [150] to [250] ms was extracted at [Fz] and [Pz] (std_readdata, EEGLAB 2026.1; window chosen a priori from [Thorpe et al., 1996]) and exported for analysis in [software and version].