bids-matlab-tools
bids-matlab-tools copied to clipboard
Export with sessions as string
Cheng shared some files (file-cheng on my computer)
However, there is no script, and the files actually have numerical sessions (in the file name itself). Also, when creating a study with these files, the files do not have sessions or subjects defined.
Cheng, please share a script that takes these files as input to recreate the problem.
I simply used the bids plugin in eeglab to export bids format. I did some scripts to identify the files from the file name etc: The bids-eeglab plugin will then automatically identify the information. The GUI from eeglab will identify the run/session/group correctly when create a study, however, it creates errors when exporting them to bids format.
Modified script below
for iEEG = 1:length(ALLEEG)
EEG = ALLEEG(iEEG);
EEG.subject = extractBefore(EEG.setname,'_'); % find out the subject ID
EEG.session = str2num(char(extractBetween(EEG.setname,'ses-','_')));
EEG.condition = char(extractBetween(EEG.setname,'task-','_'));
EEG.run = str2num(char(extractAfter(EEG.setname,'run-')));
EEG.task = EEG.condition;
ALLEEG(iEEG).task = '';
ALLEEG(iEEG) = EEG;
end
Fixed in 20f89e7
Hi Arnaud,
I have tried to export the EEG data using the branch pernet_x from eeglab but it still did not work. I got an error message as below:
Best regards,
Cheng
The same error message appears again even when I deleted that subject.
I have merged the pernet_x branch to the master branch now.
- Use the modified script above
- Import all the datasets in EEGLAB
- Export to BIDS
Works for me.
@CPernet can help. He knows how to do that.
@ChengtengIp put a few of those subjects in a folder on our server and let see what is failing or not then I can update the function as needed and PR it