<div>some sample code that might help below, from the searchable EEGLAB list archive</div><div><br></div><div><div><br></div><div>[spec439 frq439] = spectopo (EEG.data, 250, 250, 'overlap', 125,</div><div>'winsize', 250,'plot', 'off', 'chanlocs', 'GSN129.sfp');</div>
<div>xlswrite('spec439.xls', spec439(:,1:256));</div><div>xlswrite('frq439.xls', frq439);</div><div><br></div><div>or</div><div><br></div><div>left= 24;</div><div>right = 25;</div><div>[spec_24 freqs ] = spectopo(EEG.data(right,:), 250, 250, 'plot', 'off')</div>
<div>[spec_25 freqs ] = spectopo(EEG.data(left,:), 250, 250, 'plot', 'off')</div><div>[tmp alpha_ind] = min( abs(freqs-8));</div><div>asymmetry1 = spec_24(alpha_ind) - spec_25(alpha_ind);</div><div>asymmetry2 = spec_25(alpha_ind) - spec_24(alpha_ind);</div>
<div>f439= fopen('439.xls', 'w+');</div><div>dlmwrite('439.xls', asymmetry1);</div></div><br>
<br><br><div class="gmail_quote">On Fri, Jan 6, 2012 at 8:24 PM, Arnaud Delorme <span dir="ltr"><<a href="mailto:arno@ucsd.edu">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">
Dear Kathryn and Andero,<br>
<br>
the eeg_regepochs is the command line function you want to use to epoch the data into regular (possibly overlapping) segments. For example<br>
<br>
EEG = eeg_regepochs(EEG, 'recurrence', 1, 'limits', [0 2]);<br>
<br>
Then you may go back to the EEGLAB interface using the code<br>
<br>
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);<br>
eeglab redraw<br>
<br>
Note that this function can also be used to insert events without extracting epochs. We will try to make a menu for it.<br>
Best regards,<br>
<br>
Arno<br>
<div class="HOEnZb"><div class="h5"><br>
On Jan 5, 2012, at 6:24 AM, Andero Uusberg wrote:<br>
<br>
><br>
> Dear Kathryn,<br>
><br>
> all of your pipeline can be done in EEGLAB, but a few steps require<br>
> using Matlab command line interface.<br>
><br>
> For the segmentation of data EEGLAB has a function called<br>
> pop_importevent which does what the name suggests and thus allows you to<br>
> import event-markers for the 2-second epochs you'll need. As I'm not<br>
> quite sure how the function would cope with overlapping segments, I've<br>
> created non-overlapping ones at this phase and asked the spectral<br>
> analysis function pop_spectopo to apply overlapping during subsequent<br>
> FFT calculations instead.<br>
><br>
> Here is a piece of code that adds 2-second event-markers to a loaded<br>
> EEGLAB dataset.<br>
> dur = 2; % the required duration of the new events<br>
> name = 'M'; % name of the new events that appears in EEGLAB scroll plot<br>
> newEvent = {name 0 dur}; % initiate the new event list (see help<br>
> pop_importevent for details)<br>
> % the following loop will populate the list with required information<br>
> for k = 2:round((EEG.xmax-dur)/dur) % the loop runs until the end of the<br>
> loaded dataset<br>
> newEvent = cat(1, newEvent, {name newEvent{k-1,2}+dur dur}); %<br>
> specs of one event are added on each run of the loop<br>
> end<br>
> EEG = pop_importevent( EEG, 'event','externalEvent','fields',{'type'<br>
> 'latency' 'duration'},'timeunit',1,'optimalign','off'); % import the<br>
> created event list to the loaded dataset<br>
> eeglab redraw % update the GUI to reflect the command line changes<br>
><br>
> After running this code you can use the GUI-based tool to actually<br>
> segment the data (Tools -> Extract epochs).<br>
><br>
> The FFT can be calculated by the pop_spectopo function (Plot -> Plot<br>
> channel spectra and maps). See help pop_spectopo to learn how to tell<br>
> the algorithm to use overlapping in FFT calculations as well as which<br>
> kind of windowing to use.<br>
><br>
> Finally, you'll need to turn to the command-line again to perform the<br>
> subtraction of right and left power estimates. One way to do this<br>
> involves adding output variables to the pop_spectopo or spectopo<br>
> function (again, see help) and then performing the subtraction on this<br>
> output. With some struggling the subtracted data can then be plotted<br>
> using EEGLAB or Matlab tools (e.g. plot) and exported (e.g. xlswrite).<br>
><br>
> Regards,<br>
> Andero Uusberg<br>
> Tartu, Estonia<br>
><br>
><br>
> On 19.12.2011 3:51, Campbell, Kathryn wrote:<br>
>> Hi,<br>
>><br>
>> I know there have been lots of questions about this but I have not found<br>
>> any that answer all of my questions. I am completely new to using MATLAB<br>
>> and EEGLAB and am a bit overwhelmed.<br>
>><br>
>> The steps I have taken in the past to calculate alpha asymmetry were<br>
>><br>
>> 1)Segment continuous EEG data into 4 one minute blocks based on events<br>
>> markers<br>
>><br>
>> 2)For each block create a series of 2.048 second epochs overlapping by 50%<br>
>><br>
>> 3)Reject epochs with ocular or other artefacts (either manually or<br>
>> automatically)<br>
>><br>
>> 4)Calculate mean alpha power at each electrode site for each block using<br>
>> FFT with Hanning window.<br>
>><br>
>> 5)Use these figures to calculate alpha asymmetry (1n (R/L)<br>
>><br>
>> Unfortunately the system I now use to record EEG ( a very old version of<br>
>> neuroscan) doesn’t seem have all of these functions available.<br>
>><br>
>> I am able to complete the first step using EEG lab but can’t find a way<br>
>> to create overlapping epochs to move on to the next steps.<br>
>><br>
>> Is anyone able to help me? Please bear in mind I’m not that familiar<br>
>> with MATLAB.<br>
>><br>
>> Thanks<br>
>><br>
>> Kathryn<br>
>><br>
>><br>
>><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">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">eeglablist-request@sccn.ucsd.edu</a><br>
><br>
><br>
><br>
><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">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">eeglablist-request@sccn.ucsd.edu</a><br>
<br>
<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">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">eeglablist-request@sccn.ucsd.edu</a><br>
</div></div></blockquote></div><br>