Simply EEGLAB

The EEG structure

Station 1 · Lesson 3 · EEGLAB 2026.1

In the GUI

  1. Workspace EEG
  2. EditEvent values
  3. latency (sec) EEG.event
  4. Cancel

Script

EEG.setname            % 'Continuous EEG Data'
EEG.nbchan             % 32 channels
EEG.srate              % 128 samples per second
EEG.pnts               % 30504 samples per channel
(EEG.pnts - 1) / EEG.srate   % 238.3047 seconds (same as EEG.xmax)
size(EEG.data)         % 32 30504
class(EEG.data)        % 'single'
EEG.data(1, 1:5)       % first 5 samples of channel 1 (microvolts)
{EEG.chanlocs(1:3).labels}   % 'FPz' 'EOG1' 'F3'
EEG.event(1).type      % 'square'
EEG.event(1).latency   % 129.0087 (in samples)
(EEG.event(1).latency - 1) / EEG.srate   % 1.0001 (in seconds)
isempty(EEG.icaweights)   % 1 (true)

Which value should I choose?

FieldWhat it storesUnitValue in eeglab_data.set
EEG.nbchanNumber of channelschannels32
EEG.srateSampling rateHz128
EEG.pntsNumber of samples per channelsamples30504
EEG.trialsNumber of segments (1 = continuous data)segments1
EEG.xmin and EEG.xmaxTime of the first and the last sampleseconds0 and 238.3047 (last sample)
EEG.timesTime of each samplemillisecondsfrom 0 to 238304.6875
EEG.dataThe signal itselfmicrovoltsa 32 × 30504 matrix
EEG.chanlocsName and position of each channel—32 elements
EEG.eventEvents: type and latencylatency in samples154 events (80 square and 74 rt)
EEG.icaweightsICA weights—empty

Check

  • size(EEG.data) gives 32 30504
  • (EEG.pnts - 1) / EEG.srate gives 238.3047, the same as EEG.xmax and as Epoch end (sec) in the main window (shown rounded as 238.305)
  • EEG.event(1).type gives 'square', and the converted latency gives about 1.0001 seconds, matching what you saw in Edit > Event values
  • numel(EEG.event) gives 154, matching the Events line in the main window

Full lesson: https://simplyeeglab.pages.dev/en/lesson/eeg-struct/

Content license: CC BY-NC-SA 4.0 · MIT (code)

An independent learning site, not affiliated with EEGLAB or SCCN.