<div>Hi all,</div><div><br></div>Thanks to everyone for the responses!<div><br></div><div>I tried Chad's solution first, which involved manually concatenating the the 3 epoched data sets into the data field of an EEG structure, then running ICA on the concatenated set and copying the ICA results into the ICA fields in the epoched sets.  This solution works but I ran into a minor problem that's worth mentioning for anyone else who wants to do this following the solution previously posted by Chad.  When one of the data sets is copied into TEMP and all of the epoched data is added to TEMP.data, a few other fields in TEMP need to be changed (otherwise they retain the data from the copied epoched set, and the ICA command produces an error).  </div>






<div><br></div><div>TEMP.trials = 1;</div><div>TEMP.pnts = size(TEMP.data,2);</div><div>TEMP.xmin = 0;</div><div>TEMP.xmax = (TEMP.pnts/TEMP.srate);</div><div>TEMP.times = [];</div><div><br>

</div>
<div>Mikolaj and Arno, thank you for the advice on converting the epochs of different lengths to continuous data.  Mikolaj you said you thought there was an EEGLAB function to 'de-epoch' the data, so I'm guessing you were thinking of 'eeg_epoch2continuous' which Arno has also mentioned.  In case anyone else is interested, I found that you can solve this problem with the eeg_epoch2continuous function in the following way:</div>




<div><br></div><div>% epoched data set 1 = EEG1, epoched data set 2 = EEG2, epoched data set 3 = EEG3</div><div>% convert epoched data to continuous in order to merge for ICA</div><div>CEEG1 = eeg_epoch2continuous(EEG1); </div>




<div>CEEG2 = eeg_epoch2continuous(EEG2);</div><div>CEEG3 = eeg_epoch2continuous(EEG3);</div><div>MERGED_SET = pop_mergeset(CEEG1, CEEG2);</div><div>MERGED_SET = pop_mergeset(MERGED_SET, CEEG3); % pop_mergeset only works with 2 INEEG arguments</div>


<div>% run ICA on the merged data</div><div>MERGED_SET = pop_runica(MERGED_SET,'extended',1);</div>

<div>% copy ICA results into EEG1, EEG2 and EEG3 (see earlier post by Chadwick Boulay)</div><div><br></div><div>Mikolaj thank you for the link to the 'epoch_linearize' function as well.  I haven't tried it yet but plan to as it looks very useful!</div>

<div><br></div><div>My last question about this is how to do component rejection on these data.  When I first tried this I first did component rejection on the MERGED_SET, then copied the ICA fields from the merged data set into the ICA fields for each epoched data set (EEG1, EEG2, EEG3).  However I'm not sure if that actually worked, so I think what I might have to do is: 1) copy the ICA fields form the MERGED_SET into the epoched sets, 2) do component rejection on one of the sets, 3) run the component rejection command on all epoched data sets using the component numbers identified for rejection.  Is that right?</div>





<div><br></div><div>Best wishes and thanks again for the help!</div><div>Becky</div><div><br></div><div><br></div><div><br></div><div class="gmail_quote">On 7 May 2013 04:18, Arnaud Delorme <span dir="ltr"><<a href="mailto:arno@ucsd.edu" target="_blank">arno@ucsd.edu</a>></span> wrote:<br>







<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">The command line function eeg_epoch2continuous also allows to transform EEG epochs into a continuous dataset.<div>







Best,</div><div><br></div><div>Arno</div><div><div><div><br><div><div>On 5 May 2013, at 16:06, Mikołaj Magnuski wrote:</div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra">It seems I didn't send my last message to eeglablist, it can be found at the end of this one.</div>







<div class="gmail_extra"><br>Anyway, Becky, I have found and uploaded the beforementioned function<br>
to <a href="https://sites.google.com/site/analizasygnalow/zasoby/nasze-narzedzia" target="_blank">https://sites.google.com/site/analizasygnalow/zasoby/nasze-narzedzia</a><br>the function name is epoch_linearize.m and it is called this way:<br>








newEEG = epoch_linearize(EEG);<br><br>it does not retain events, but you don't need these for ICA.<br>For linearizing multiple files you can use linearize_all_eeg<br>(also on the page) like this:</div><div class="gmail_extra">








ALLEEG = linearize_all_eeg(files, folder);</div><div class="gmail_extra">'files' is assumed to be a cell matrix of file names<br>(for example: {'subj01.set', 'subj02.set'}), while 'folder'<br>








a string defining filepath (like: 'C:\DATA\Exp1_2012\').<br><br>You would still have to save these files and later<br>join relevant ones. I had a script for this too<br>where you could specify with regular expressions<br>








what files should be linearized and then concatenated, </div><div class="gmail_extra">but I didn't transform it into a more universal function, </div><div class="gmail_extra">I'll try to do this soon if you would find it useful.<br>








<br>If you have any troubles using these functions -<br>let me know!<br><br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">







<p>You can also transform all your subject subfiles (epochs of different length) into continuous signals (instead of epochs you can place 'boundary' events, although it is not necessary for ICA) - such that you have one file per subject. Then you would perform ICA and copy ica weights to your original epoched files. I think there is a function in EEGlab to 'de-epoch' the data (Arno, Makoto, am I correct?). Anyway - I wrote such function some time ago, so I'll see if I can still find it. The function did not retain events from the original dataset, but you do not need this for ICA. <br>











(there is yet another option - you could epoch the data into small chunks of 1-s long or so, reject epochs containing artifacts or signal of no interest, then perform ICA and copy ica weights to your normally epoched data. I too have a function for this, which allows for several useful options like automatic rejection of windows (these small epochs) that are too far from cerain events or event sequences - so that you wouldn't have to manually click and reject windows ocurring in breaks or during a task you are not interested in. Unfortunatelly the function help is still in polish - but the basic options are easy to explain in one short mail - that is if you think you will find such function useful)<br>











</p>
<div class="gmail_quote">30 kwi 2013 19:24, "Becky Prince" <<a href="mailto:becky.prince@york.ac.uk" target="_blank">becky.prince@york.ac.uk</a>> napisał(a):<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">









<div><div>
Dear EEGLAB users,<div><br></div><div>I have a question about the best artifact detection and ICA procedures for data sets with multiple epoch types of different lengths.  </div><div><br></div><div>Each trial in my EEG task is made up of 3 non-overlapping epochs of interest: 1) 4 seconds, 2) either 1.5 or 2.5 seconds, 3) 2.5 seconds.  For my previous ERP experiments I've used the following data processing procedure: epoch the data, reject bad epochs, run ICA on remaining epochs, reject ICA components, analyze data in channel space.  For my current experiment (with 3 epochs per trial), I haven't been able to run ICA on all of the epoched data at once because, as soon as I epoch the data, it is split into a separate data set.  I'm fairly sure that these 3 separate epoched data sets cannot be merged/appended for a single ICA run because the epochs are of differing lengths.</div>












<div><br></div><div>I've come up with 2 different protocols for processing the individual data sets.  I'm not sure which is better or if I'm overlooking other options.</div><div><br></div><div>Solution 1: artifact rejection and ICA on continuous data</div>












<div>1) reject artifacts in continuous data</div><div>2) run ICA on continuous data</div><div>3) reject ICA components</div><div>4) epoch the data (creates 3 separate data sets)</div><div>5) analyze data in channel space</div>












<div><br></div><div>Solution 2: artifact rejection and ICA on epoched data</div><div>1) epoch the data (creates 3 separate data sets)</div><div>Then for each of the 3 epoched data sets: </div><div>2) reject epochs</div><div>












3) run ICA on remaining epochs</div><div>4) reject ICA components</div><div>5) analyze data in channel space   </div><div><br></div><div>My problem with solution 1 is that it is much more time consuming to detect the artifactual sections of continuous data than it is to detect and reject bad epochs.  Also, ICA seems to run more slowly in this case (even after taking into account the differences in the size of the continuous and epoched data sets).  My problem with solution 2 is that it doesn't seem right to run ICA separately for each epoched data set for the same subject/session.  Because I am doing within-subject comparisons among the 3 trial segments, I'm concerned about producing artificial differences among these epochs as a result of differences in the ICA decomposition and component rejection.</div>












<div><br></div><div>Sorry for the long question.  Can anyone tell me what they would recommend?  Any suggestions and/or criticisms of my current processing steps would be very helpful!</div><div><br></div><div>Many thanks,</div>












<div>Becky</div><div>PhD Candidate</div><div>Department of Psychology</div><div>University of York</div><div><br></div>
<br></div></div>_______________________________________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>
To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>
For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">eeglablist-request@sccn.ucsd.edu</a><br></blockquote></div>
</blockquote></div><br></div></div>
_______________________________________________<br>Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>







For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">eeglablist-request@sccn.ucsd.edu</a></blockquote></div><br></div></div></div>







</div><br>_______________________________________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>
To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>
For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">eeglablist-request@sccn.ucsd.edu</a><br></blockquote></div><br>