<div dir="ltr"><div class="gmail_default" style="color:rgb(51,51,153)">Hello Martin, some thoughts below. Best wishes.<br></div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)">******************************<wbr>*************</div><div class="gmail_default" style="color:rgb(51,51,153)"><div class="gmail_default">Overall having different epoch lengths is unusual and requires you use a non-traditional strategy. See below for some suggestions about that. </div><div class="gmail_default">If you haven't had a chance to, try googling  "eeglablist _ your topic" such as "eeglablist list epoching" or "eeglablist triggers/markers".  or "eeglablist different length epochs"</div><div class="gmail_default"><br></div></div><div class="gmail_default"><font color="#333399">******************************<wbr>*****************</font></div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)">Yes I don't think that eeglab allows epochs of different lengths for it's functions, at single-subject and at Study level. So you may want to decide on a common event across trials, such as a stimulus or feedback onset, and cut the epochs to be a similar length relative to one of those events. With pop_epoch I think you are limited to same-length epochs. To generate single-subject averages across individual epochs, one traditionally needs a common event in each trial, and a common trial length. Same for all-subject grand-averages. You may have to figure out some alignment strategy regardless of whether your epochs are same or different lengths. your best best is to follow the strategy published by EEG researchers for a similar paradigm and problem, in a good journal.</div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)">One option might be to save out ALL the EPOCHS that HAVE THE SAME LENGTH as unique trials in a unique subject file, and then do the same for other different length epochs. This assumes you have a few major classes of epoch length. Alternatively, each epoch could be saved out independently and analyzed at single-trial level, but you would  have to align them somehow for any averaging across epochs. Technically, you could estimate an EEG metric for each different length epoch, and then average those metrics, but this is unusual, as the single-epoch data is the same time length in usual EEG analyses. <br></div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)">********************to modify events before epoching</div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)">You can edit the events one by one from the gui, or use eegh, after doing some from the gui, in order to repeat that process in a script. Then epoch.</div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)">You can create a matlab loop that looks at each event (and it's context) and then adds new events. Examine the online eeglab tutorial about event structures in eeglab. You would want to make a set of rules that creates a new set of events for you to use.</div><div class="gmail_default" style="color:rgb(51,51,153)"><br></div><div class="gmail_default" style="color:rgb(51,51,153)">See previous eeglablist posts or google the documentation for an eeglab function called eeg_addnewevents, or something like that, and similar discussions of dealing with events. This should allow you to create a set of labels and times, and then apply them , in one function call to a continuous file (via the aforementioned add new events function, or some other similar method). Then you should be able to epoch on the events of your choice.</div><div class="gmail_default" style="color:rgb(51,51,153)">Another way to do it is to "import" a list of new/additional events. See the eeglab tutorials/pages on events, events structure, and importing events.</div><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline">​***Not sure if this directly related to your question, but perhaps it will help:: You could also build a loop that checks for some conditions in the event sequence before the loop creates one or more epochs in a new file with pop_epoch.​</div> <div class="gmail_default" style="color:rgb(51,51,153);display:inline">​So in this case, your loop would pop_epoch only if the event in the continuous file has the correct conditions (events before and after it) that you are seeking.​ Then your loop would reload the original file, go to the next set of events, and decide again whether or not to epoch.</div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div><div><div class="gmail_default" style="color:rgb(51,51,153);display:inline"><br></div></div></div><br></div></div>