1. Formatting Input Object and Analysis Parameters - jasonnan2/Automated-Analysis-of-EEG GitHub Wiki

Your input should follow a specific structure using a MATLAB struct called project. Below is a guide to each required field and how to populate it. Sample Script

Example


% ---------------------
% Project Metadata
% ---------------------
project.info.freq_list          = {'theta', 'alpha', 'beta', 'broadband'};
project.info.timeAxis           = -500:4:1496;
project.info.groupNames         = {'Group1','Group2','Group3'};
project.info.variables          = {'NeuralVarName'};
project.info.chanlocs           = chanlocs;
project.info.roi                = roi;
project.info.experimentalDesign = 'twoSample';

% ---------------------
% EEG Data (Scalp)
% ---------------------
project.scalpData.Group1.var1     = Group1Var1EEG;     % [F × C × T × N]
project.scalpData.Group1.var2     = Group1Var2EEG;     % [F × C × T × N]
project.scalpData.Group1.subList  = Group1subList;     % {'sub1','sub2',...}

project.scalpData.Group2.var1     = Group2Var1EEG;     % [F × C × T × N]
project.scalpData.Group2.var2     = Group2Var2EEG;     % [F × C × T × N]
project.scalpData.Group2.subList  = Group2subList;     % {'sub1','sub2',...}

% ---------------------
% Source Localized Data
% ---------------------
project.sourceData.Group1.var1    = Group1Var1SRC;     % [F × R × T × N], where R = number of ROIs
project.sourceData.Group1.subList = Group1subList;     % {'sub1','sub2',...}

Project Metadata

Project definitions are saved in a struct called project.info.

Field Description
experimentalDesign 'paired' or 'twoSample' — determines the type of t-test to perform.
freq_list Cell array of frequency band names, in order of the first dimension (F) in the data. Example: {'theta', 'alpha', 'beta'}
timeAxis 1×T vector of timepoints in milliseconds. Must match the third dimension (T) of the data. Example: -500:4:1500
groupNames Cell array of strings naming each group. Must match the field names in scalpData or sourceData. Example: {'Group1', 'Group2'}
variables Cell array of variable names. Must match the field names used within each group. Example: {'var1', 'var2'}
chanlocs EEGLAB channel location structure (for scalp data).
roi Cell array of ROI names (for source data, e.g., from BSBL or Brainstorm).

Formatting EEG Data

Each group (e.g., Group1, Group2) is a field under project.scalpData or project.sourceData. The structure inside each group should follow the layout below:


Group-Level Data - project.scalpData / project.sourceData:

Field Description
var1, var2, ... Neural variables (e.g., power, phase, trial type, etc.). Each is a 4D matrix of size [Frequencies × Channels/ROIs × Time × Subjects].
subList Cell array of subject IDs for this group. Example: {'sub1', 'sub2', ..., 'subN'}

For scalpData, the second dimension of the data corresponds to EEG channels.
For sourceData, the second dimension corresponds to ROIs.