-
I just got asked how to best import EEG-lab style .set |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Let's first download a dataset: using OpenScienceFramework
const OSF = OpenScienceFramework
osf_proj = OSF.project(OSF.Client(), "wbz7x")
cp(readdir(osf_proj)[1], tempdir()*"/unfold_tempdata.zip") # copy / download
run(`unzip $(tempdir()*"/unfold_tempdata.zip") -d $(tempdir()*"/unfold_tempdata_unzipped/")`) # unzip Now that we have an eeglab-file, we can extract the events: using MAT
using DataFrames
EEG = MAT.matread("/tmp/unfold_tempdata_unzipped/face_saccades_opendata_fig10.set")
evts = DataFrame([k=>dropdims(v,dims=1) for (k,v) in EEG["EEG"]["event"]]) Why so complicated with Tipp: It might be necessary to convert the columns to proper types (by default function converter(v)
v2 = try
Float64.(v)
catch
string.(v)
end
return dropdims(v2,dims=1)
end
evts2 = DataFrame([k=>converter(v) for (k,v) in EEG["EEG"]["event"]])
end If this code helps you, please comment! Then others know they are on the right track :) |
Beta Was this translation helpful? Give feedback.
-
Thank you for this very helpful example. It works without issue with the .set files from your tuto but with our data, we get : ERROR: KeyError: key "EEG" not found On the other hand, it works if we save the EEG structure from EEGlab in .mat format ... |
Beta Was this translation helpful? Give feedback.
Let's first download a dataset:
Now that we have an eeglab-file, we can extract the events:
Why so complicated with
dropdims
? Because MATLAB automatically saves vectors as…