Simply EEGLAB
MATLAB basics for EEGLAB
Station 0 · Lesson 3 · EEGLAB 2026.1
In the GUI
- Command WindowWorkspaceCurrent Folder
- New ScriptHome
- RunEditor
.mdemo_basics
Script
demo.srate = 128; % sampling rate (samples per second)
demo.nbchan = 3; % number of channels
demo.pnts = 10 * demo.srate; % samples per channel
demo.labels = {'Fz', 'Cz', 'Pz'}; % channel names (a cell array of text)
demo.data = randn(demo.nbchan, demo.pnts); % random numbers, channels x samples
size(demo.data) % rows = channels, columns = samples
demo.srate % one field
demo.labels{2} % text of the second channel name
firstSamples = demo.data(2, 1:5)
t = (0:demo.pnts-1) / demo.srate;
t(end)
figure;
plot(t, demo.data(2, :));
xlabel('Time (s)'); ylabel('Amplitude');
title(['Channel ' demo.labels{2}]);
whos demo % size and type of a variable
which plot % location of a function on the pathWhich value should I choose?
| You type | Meaning | Example from the lessons |
|---|---|---|
a = 5 | Create a variable and print its value | x = 5 |
a = 5; | Same, without printing | EEG = pop_eegfiltnew(EEG, 'locutoff', 0.1); |
s.name | A field inside a struct | EEG.srate |
m(2, 1:5) | Elements of a matrix, with round brackets | EEG.data(1, 1:10) |
c{2} | Contents of a cell array element, with curly braces | demo.labels{2} |
'text' | Text in single quotes | 'locutoff' |
% | Everything after it on the line is a comment and is not run | % high-pass |
help name | Help for a function in the Command Window | help pop_eegfiltnew |