[Eeglablist] Save epoch subsets

Dagfinn Matre Dagfinn.Matre at stami.no
Thu Apr 5 23:07:58 PDT 2018


Dear EEGLAB experts,

Using a matlab script, I would like to split an epoched file with say 90 epochs into subset 1 (epoch 1:30), subset 2 (31:60), subset 3 (61:90), and save these subsets in separate set-files.

It works fine for the first subset with this code:

EEG = pop_loadbva(filliste(n).name);
EEG = eeg_checkset( EEG );
EEG = pop_select( EEG,'trial',[1:30] );
EEG = eeg_checkset( EEG );
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 1,'setname','temp','gui','off');
EEG = pop_saveset( EEG, 'filename',new_filename,'filepath',savedir);

The problem appears when I want to re-select the mother dataset containing all epochs in order to select the next subset. Using the GUI and saving the eeglabhist.m indicates that this is the next line of code,

[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 2,'retrieve',1,'study',0);

but when I continue with this line, selecting the next trials, matlab returns "Error: dataset is empty".

EEG = pop_select( EEG,'trial',[31:60] );

Any ideas anyone?

Best,
Dagfinn Matre


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20180406/927141cc/attachment.html>


More information about the eeglablist mailing list