Clear Filters
Clear Filters

How to convert .edf EEG file to .set using a script

37 views (last 30 days)
Dear community
I'm working on a study that uses different types of EEG equipment, so I work with files in formats such as .edf and .raw.
Right now, in my data processing script, I've been using the script below to automatically convert (instead of manually converting in EEGLab for example) .raw files into .set.
However, I am not able to edit this script to convert .edf files into .set.
Can you help me?
best
Lucas
Script:
%files .raw extension
name_subj_raw = {'AAM_SPEC_OA_pre'};
%total files (same than raw; misses .eeg files)
name_subj = {'AAM_SPEC_OA_pre'};
%label the channels (confirm this 'FidNz';'FidT9';'FidT10';)
label_ch = {'E1';'E2';'E3';'E4';'E5';'E6';'E7';'E8';'E9';'E10';'E11';'E12';'E13';'E14';'E15';'E16';'E17';'E18';'E19';'E20';'E21';'E22';'E23';'E24';'E25';'E26';'E27';'E28';'E29';'E30';'E31';'E32';'E33';'E34';'E35';'E36';'E37';'E38';'E39';'E40';'E41';'E42';'E43';'E44';'E45';'E46';'E47';'E48';'E49';'E50';'E51';'E52';'E53';'E54';'E55';'E56';'E57';'E58';'E59';'E60';'E61';'E62';'E63';'E64';'E65';'E66';'E67';'E68';'E69';'E70';'E71';'E72';'E73';'E74';'E75';'E76';'E77';'E78';'E79';'E80';'E81';'E82';'E83';'E84';'E85';'E86';'E87';'E88';'E89';'E90';'E91';'E92';'E93';'E94';'E95';'E96';'E97';'E98';'E99';'E100';'E101';'E102';'E103';'E104';'E105';'E106';'E107';'E108';'E109';'E110';'E111';'E112';'E113';'E114';'E115';'E116';'E117';'E118';'E119';'E120';'E121';'E122';'E123';'E124';'E125';'E126';'E127';'E128'};
%misses loop to import .eeg files
%loop to import .raw files
for s = 1:length(name_subj_raw)
%load file
EEG = pop_readegi([pathname name_subj_raw{s} '_OF.raw'], [],[],'auto');
%setname
dataset_name = strcat(name_subj_raw{s},'_OF.set');
EEG.setname=dataset_name;
EEG = pop_saveset(EEG, 'filename',dataset_name,'filepath',pathname);
end

Accepted Answer

Sachin
Sachin on 17 Feb 2023
As per my understanding, you are trying to convert .edf EEG file to .set using MATLAB script. Referring the following information might be of good help to you.
  1. You may use ‘edfread’ to get data into MATLAB
2. In order to convert data in '.mat' to ‘.set’ format you may refer following details.
It is important to input correct dimensions of the input data when you load a .mat file. Before importing .mat into EEGLab, you will need to load your data files into MATLAB and use reshape or other function to format it in the correct way. More details and information can be found here :
Regards
Sachin
  1 Comment
Lucas Marques
Lucas Marques on 22 Feb 2023
Dear Sachin! Thank you for your complete reply.
I'll work on this script in the next weeks.
Thank you
Lucas

Sign in to comment.

More Answers (0)

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!