Can't load datasets in EEGLAB using script

조회 수: 11 (최근 30일)
Elise
Elise 2024년 7월 11일
편집: Diego Caro 2024년 7월 13일
I'm trying to create a loop that can load and preprocess EEG data sets, here is my code and the reoccuring error
[ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );
%% Get the list of subjects to load:
dataset = uigetdir;%allows user to manually select the folder where the data sets are stored
subjectlist = dir(dataset);
subjectlist = subjectlist(~ismember({subjectlist.name},{'.','..'}));
SUB = {subjectlist(:).name};
filepath = {subjectlist(:).folder};
%%
%load data
for i = 1 : length(SUB)
% 0. Select subject id:
%subject = subjectlist(i);
% Print info to the command window
% display('Processing Subject %s\n', SUB(i));
%Define subject path based on study directory and subject ID of current subject
Subject_Path = filepath{i};
Subject_Path = convertCharsToStrings(Subject_Path);
% 1. Load subject data:
% subject_data = load_subject_data(cfg,subject);
[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;
EEG = pop_loadset('filename', SUB{i},'filepath', Subject_Path);
EEG = eeg_checkset(EEG);
end
eeglab redraw;

답변 (1개)

Diego Caro
Diego Caro 2024년 7월 12일
편집: Diego Caro 2024년 7월 12일
Hi, Elise
Your code seems to run fine for me after trying it with some of my datasets. I am using EEGLAB v2021.1. However, the code you provided does not store the EEG's structures of the loaded datasets. You can use the following code to save them in a structure, which is helpful to work with them.
%% Get the list of subjects to load:
% this is the first section of your code
dataset = uigetdir;%allows user to manually select the folder where the data sets are stored
subjectlist = dir(dataset);
subjectlist = subjectlist(~ismember({subjectlist.name},{'.','..'}));
SUB = {subjectlist(:).name};
filepath = {subjectlist(:).folder};
%% This saves all EEG's in the eegs struct
eeglab nogui
eegs = struct('sub',cell(1,length(SUB)));
for i = 1:length(SUB)
file = fullfile(filepath{i},SUB{i});
eegs(i).sub = pop_loadset(file);
eegs(i).sub = eeg_checkset(eegs(i).sub);
end
eeglab redraw
Let me know if it works for you.
Regards,
Diego.
  댓글 수: 2
Elise
Elise 2024년 7월 12일
No, still the same error
Diego Caro
Diego Caro 2024년 7월 13일
편집: Diego Caro 2024년 7월 13일
I'm sorry to hear that. There are a few more things you can try.
  1. Try loading your datasets (.set files) manually using the eeglab graphic interface and make sure your signals are in good state.
  2. Run the code I shared using the dataset I provide (Sub07B_alpha.set). The eeglab window should look something like this:
If the code runs fine, that means something in your datasets may be corrupted and thus, eeglab cannot import the file. If the code throws you the same error, or if your dataset loads properly with the graphical interface, but not with the code, maybe consider switching to other EEGLAB version.
Hope this helps to resolve your issue.
Regards,
Diego.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 EEG/MEG/ECoG에 대해 자세히 알아보기

태그

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by