Skip to content

Instantly share code, notes, and snippets.

@sylvchev
Created May 11, 2018 02:59
Show Gist options
  • Save sylvchev/259a390e0b879d95b0d51a6918fea609 to your computer and use it in GitHub Desktop.
Save sylvchev/259a390e0b879d95b0d51a6918fea609 to your computer and use it in GitHub Desktop.
Convert EEG GDF file to matlab file (then python)
clear all
datadir='/path/to/data/ssvep-esta/';
for i = 2:2
subjdir = strcat(datadir, sprintf('subject%2.2d/', i));
files = dir(strcat(subjdir, '*.gdf'));
for f=1:length(files)
[s,h] = sload(strcat(subjdir, files(f).name));
EVENTTYP = h.EVENT.TYP;
EVENTPOS = h.EVENT.POS;
SampleRate = h.SampleRate;
[~ ,FileName, ~] = fileparts(files(f).name);
save(strcat(subjdir, FileName, '.mat'), 's', 'EVENTTYP', 'EVENTPOS', 'SampleRate', 'FileName');
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment