Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems running code for an .edf file #1

Open
orasanen opened this issue Jan 12, 2023 · 0 comments
Open

Problems running code for an .edf file #1

orasanen opened this issue Jan 12, 2023 · 0 comments

Comments

@orasanen
Copy link

I'm running MATLAB R2022b on MacOS.

I'm trying to run the feature extraction code for a single .edf file in a folder, which I have specified in main.m. However, there are several problems:

Problem 1) When running main.m, in preprocessing.m channel labels turn out like this:

labels =

  1×14 cell array

    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}    {16×1 char}


ans =

  16×1 char array

    'A'
    '1'
    ' '
    ' '
    ' '
    ' '
    ' '
    ' '
    ' '
    ' '
    ' '
    ' '
    ' '
    ' '
    ' '
    ' '

which I can fix with:

labels_tmp = cell(length(labels),1);

for k = 1:length(labels)
    for j = 1:length(labels{k})
        labels_tmp{k}(j) = labels{k}(j);
    end
    labels_tmp{k} = ['EEG ' strtrim(labels_tmp{k})];
end
labels = labels_tmp;

After which my labels are

labels =

  14×1 cell array

    {'EEG A1'   }
    {'EEG A2'   }
    {'EEG C3'   }
    {'EEG C3-A2'}
    {'EEG C4'   }
    {'EEG C4-A1'}
    {'EEG F3'   }
    {'EEG F3-A2'}
    {'EEG F4'   }
    {'EEG F4-A1'}
    {'EEG O1'   }
    {'EEG O1-A2'}
    {'EEG O2'   }
    {'EEG O2-A1'}

Problem 2) last_channel definition does not work if there is no P4 (like this example file from Sampsa V.). I fixed it with this

%last_channel = find(strncmp('EEG P4',labels,6)); 
last_channel = length(labels);

Problem 3) When that is fixed, preprocessing starts to work, but I always get

Warning: Could NOT processs artefact removal. 
> In preprocess (line 85)
In init_Preprocessing (line 52)
In processBTVisual (line 50)
In main (line 21) 
Continue without artefact rejection? Y/N: 

Problem 4) If I keep spamming Y for all channels, processing starts, the code always eventually crashes to:

Analyzing and transferring files to the workers ...done.
Error using wavelet_coeff_toronto
An UndefinedFunction error was thrown on the workers for ‘wfilters’.  This might be because the file containing ‘wfilters’ is not accessible on the workers. Use addAttachedFiles(pool, files) to specify the required files to be
attached.  For more information, see the documentation for ‘parallel.Pool/addAttachedFiles’.
Error in extractFeatures (line 55)
    parfor ch = 1 : size(eeg_seg_accepted, 1)
Error in calEpochFeatures (line 50)
    feats = extractFeatures(eeg_seg,fs,features,labels,artefactThreshold);
Error in init_featureExtraction (line 49)
    [feats]=calEpochFeatures(eeg_data,fs_new,epochs,...
Error in processBTVisual (line 56)
[FeatureMatrix] = init_featureExtraction(data,epochs,featurelist,‘’,artefactThreshold);
Error in main (line 21)
processBTVisual(pathToPatient)
Caused by:
    Undefined function ‘wfilters’ for input arguments of type ‘char’.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant