2. Analysis Configuration: Required and Optional Definitions - jasonnan2/Automated-Analysis-of-EEG GitHub Wiki
To run an analysis, you must define a few required parameters, including time windows of interest (timeRange
) and the baseline period (baselineTime
). Additional optional settings can be customized through the cfg
struct to control how the analyses are run and plotted.
Example: Defining Required Fields
% Required analysis definitions
baselineTime = [-250 -50];
timeRange = struct();
timeRange.time1 = [0 500];
timeRange.time2 = [500 1000];
timeRange.time3 = [1000 1500];
Example: Optional Config Definition
cfg = struct();
cfg.vars2plot = {'NeuralVarName'};
cfg.freq2plot = {'theta','alpha','beta'};
cfg.times2plot = {'time1'};
cfg.combinations = [1 2];
cfg.groups2plot = [1 2];
cfg.chans2plot = 'all'; % or e.g., {'Cz', 'Pz'}
cfg.errorType = 'none';
cfg.FDRflag = 1;
cfg.toPlot = 1;
cfg.isnormal = 'auto';
Required Parameters
Field | Description |
---|---|
baselineTime |
A 1×2 vector specifying the baseline correction window (in ms), aligned to project.info.timeAxis . If you do not want baseline correction, this can be left as an empty vector []. Example: [-250, -50] |
timeRange |
A structure defining labeled time windows of interest, where each field is a 1×2 vector of [start, end] times (in ms). These labels are used later in cfg.times2plot . Example: timeRange.time1 = [0, 500]; timeRange.time2 = [500, 1000]; |
⏱️ Note: These time windows must match the scale of
project.info.timeAxis
.
cfg
Struct)
Configuring Analysis (The cfg
struct allows you to customize analysis options. This is not required for data formatting, but is passed when running main analysis functions like analyzeScalp()
or analyzeSource()
.
Default values are assigned automatically if not provided by the user.
cfg
Field Reference
Field | Description |
---|---|
vars2plot |
Cell array of variable names to analyze. Must be a subset of project.info.variables . Default: all variables |
freq2plot |
Cell array of frequency bands to include. Must match project.info.freq_list . Default: all frequencies |
times2plot |
Cell array of time window labels defined in project.info.timeRange . Default: all available time ranges |
combinations |
Nx2 matrix of group index pairs to compare. Default: all 2-group combinations |
groups2plot |
Vector of group indices to include (e.g., [1 2] ). Default: all groups |
chans2plot |
'all' (all significant) or a cell array of specific channels (e.g., {'Pz', 'Cz'} ). Default: 'all' |
rois2plot |
Numeric vector of ROIs to include (source analysis). _Default: all rois 1:length(project.info.roi) |
errorType |
Type of error bars for ERP plot: 'none' , 'sem' , or '95CI' . Default: 'none' |
FDRflag |
Boolean flag (1/0) to perform FDR correction. Default: 1 |
toPlot |
Boolean flag to enable initial topographic/brain ROI plotting. Default: 1 |
isnormal |
Specifies assumption about data normality: 'auto' (determine automatically with adtest()), 1 (normal), or 0 (non-normal). Default: 'auto' |
color_list |
Cell array of color codes (e.g., {'r','b','g'} ) to use for plotting. Default: MATLAB color set |
hmFile |
Path to head model file for plotting (if needed). Default: Uses default headmodel from dsi '' |
netConMethod |
Method used in network connectivity: 'net' or 'roi' (if applicable). Default: 'net' |