0

I'm using EEGLab and I'm having an issue. Indeed, I'm trying to load a vhdr files in order to preprocess datas. However, an error message occurs each time.

The error message goes as followed:

"Error using fopen Unable to find file. Ensure file exists and path is valid.

Error in readbvconf (line 59) fid = fopen(fullfile(pathname, filename), 'r');

Error in pop_loadbv (line 87) hdr = readbvconf(path, hdrfile);

Error in GlobalScript_ds_loc_hp (line 62) EEG = pop_loadbv('path', data_path, 'hdrfile',[subject_list{s} '.vhdr']);"

Here's the script below. Thanks !

%% Clear memory and the command window
        clear;
        clc;
        
     % Initialize the ALLERP structure and CURRENTERP
        ALLERP = buildERPstruct([]);
        CURRENTERP = 0;  
     
     %% variables   
     % This defines the set of subjects
        subject_list = {'D3'};
        %subject_list = {'p21'};
        nsubj        = length(subject_list); % number of subjects
   
        home_path  =   'C:\Users\labo\Desktop\Data\filt01_artefacts_before_ica_cleanline\';
      
      
     
     
        
     % Loop through all subjects
        for s=1:nsubj
     
            fprintf('\n******\nProcessing subject %s\n******\n\n', subject_list{s});
     
            % Path to the folder containing the current subject's data
            data_path  = [home_path subject_list{s} '\'];
            
            sname      = [data_path subject_list{s} '.vhdr'];
            
            if exist(sname, 'file')<=0
                    fprintf('\n *** WARNING: %s does not exist *** \n', sname);
                    fprintf('\n *** Skip all processing for this subject *** \n\n');
                    
            else
                fprintf('\n\n\n**** %s: formatting file ****\n\n\n', subject_list{s});
                disp(data_path);
                disp([subject_list{s} '.vhdr']);
                disp(sname);
                disp(fullfile(data_path,[subject_list{s} '.vhdr']));
                EEG = pop_loadbv('path', data_path, 'hdrfile',[subject_list{s} '.vhdr']);
                EEG.setname = [EEG.setname '_raw'];
                EEG = pop_saveset(EEG, 'filename', [EEG.setname '.set'], 'filepath', data_path);
                %{
                EEG = pop_loadset('filename', [subject_list{s} '_raw.set'], 'filepath', data_path);
                EEG = pop_resample( EEG, 250);
                EEG.setname = [EEG.setname '_rs'];
                EEG = pop_saveset(EEG, 'filename', [EEG.setname '.set'], 'filepath', data_path);
                EEG = pop_chanedit(EEG, 'lookup','C:\\Users\\labo\\Downloads\\eeglab2021.0\\plugins\\dipfit4.2\\standard_BEM\\elec\\standard_1005.elc');
                EEG.setname = [EEG.setname '_loc'];
                EEG = pop_saveset(EEG, 'filename', [EEG.setname '.set'], 'filepath', data_path);
                EEG  = pop_basicfilter( EEG,  1:62 , 'Boundary', 'boundary', 'Cutoff',  0.1, 'Design', 'butter', 'Filter', 'highpass', 'Order',  2 );
                EEG.setname = [EEG.setname '_hp'];
                EEG = pop_saveset(EEG, 'filename', [EEG.setname '.set'], 'filepath', data_path)
                %}
            end
        end
Bas H
  • 2,114
  • 10
  • 14
  • 23
LordGaga
  • 13
  • 3

0 Answers0