[Eeglablist] Save epoch subsets
Dagfinn Matre
Dagfinn.Matre at stami.no
Thu Apr 12 04:20:09 PDT 2018
Hi Eric
Thanks, this worked perfectly!
Also, thanks to Andreas Widmann, who basically proposed the same solution.
Best,
Dagfinn
Fra: Eric Rawls [mailto:elrawls at email.uark.edu]
Sendt: mandag 9. april 2018 19.51
Til: Dagfinn Matre <Dagfinn.Matre at stami.no>
Kopi: eeglablist at sccn.ucsd.edu
Emne: Re: [Eeglablist] Save epoch subsets
This is because you replace the original dataset with the new set in EEG = pop_select( EEG,'trial',[1:30] );
Instead try
%Load File
EEG = pop_loadbva(filliste(n).name);
%Create new sets containing only the selected trials
EEG1 = pop_select( EEG,'trial',[1:30] );
EEG2 = pop_select( EEG,'trial',[31:60] );
EEG3 = pop_select( EEG,'trial',[61:90] );
%Save these sets
EEG1 = pop_saveset( EEG1, 'filename','EEG_1','filepath',savedir);
EEG2 = pop_saveset( EEG2, 'filename','EEG_2','filepath',savedir);
EEG3 = pop_saveset( EEG3, 'filename','EEG_3','filepath',savedir);
This way you never replace the main EEG set.
E
Eric Rawls
University of Arkansas
On Fri, Apr 6, 2018 at 1:07 AM, Dagfinn Matre <Dagfinn.Matre at stami.no<mailto:Dagfinn.Matre at stami.no>> wrote:
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
_______________________________________________
Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu<mailto: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<mailto:eeglablist-request at sccn.ucsd.edu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20180412/e0ff41bc/attachment.html>
More information about the eeglablist
mailing list