[Eeglablist] EEGlab Import events on loop - error

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Fri Jul 3 16:14:49 PDT 2020


Dear Bruno,

If I understood your question correctly...
The variable ALLEEG is one of the structures automatically generated by
calling 'eeglab'. After calling 'eeglab', ALLEEG = []. It is actually the
same as running ' ALLEEG = []' then run your code. Please try it to see if
it works.

Makoto

On Thu, Jul 2, 2020 at 3:04 PM <bruno.de at ovgu.de> wrote:

> Dear list members,
>
> I want my code to load all .set files in a folder
> (['E:\PM_Frequency\EEG\2_correctTriggers\), then import the events
> from .csv files
> ('E:\\PM_Frequency\\EEG_log_files\\EEG_Log_Files_Renamed\\') into the
> loaded .set files and save them into another directory
> ('E:\\PM_Frequency\\EEG_Data_To_Epoch\\').
> It works fine when using the GUI, so I've used the history function
> from matlab:
> clc
> clear
> sub = [01, 02, 03, 04, 05, 06, 07, 08, 09, 10:44];
> run = [1:3];
> % Loop between all subjects and runs
> for i = sub;
>      for j = run;
>          if
> exist(['E:\PM_Frequency\EEG\2_correctTriggers\',sprintf('p0%i_%i.set',
> i,j)]);
>              EEG = pop_loadset('filename',sprintf('p0%i_%i.set',
> i,j),'filepath','E:\\PM_Frequency\\EEG\\2_correctTriggers\\');
>              [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0);
>              EEG = eeg_checkset( EEG );
>              new_file_name = [EEG.setname];
>              EEG = pop_importevent( EEG,
> 'append','no','event','E:\\PM_Frequency\\EEG_log_files\\EEG_Log_Files_Renamed_3_Columns\\',sprintf('p0%i_%i.csv',
> i,j),'fields',{'latency' 'type'
> 'duration'},'skipline',1,'timeunit',1);
>              [ALLEEG, EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
>              EEG = eeg_checkset( EEG );
>              EEG = pop_saveset( EEG,
>
> 'filename',new_file_name,'filepath','E:\\PM_Frequency\\EEG_Data_To_Epoch\\');
>              EEG = pop_saveset( EEG, 'filename',sprintf('p0%i_%i.set',
> i,j),'filepath','E:\\PM_Frequency\\EEG_Data_To_Epoch\\');
>              [ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
>          else
>              %do nothing
>          end
>      end
> end
>
> But I've received the following error message after executing the code:
>
> pop_loadset(): loading file
> E:\\PM_Frequency\EEG\2_correctTriggers\p01_1.set ...
> Reading float file 'E:\\PM_Frequency\EEG\2_correctTriggers\p01_1.fdt'...
> Undefined function or variable 'ALLEEG'.
>
> Error in set_events_using_log_files (line 16)
>              [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 1);
>
> If I delete this line:
>              [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );
>
> I would really appreciate any help,
>
> Cheers,
>
> Bruno
>
>
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>



More information about the eeglablist mailing list