# [Eeglablist] Plotting single channels

Stefan Debener s.debener at uke.uni-hamburg.de
Mon Oct 16 05:37:48 PDT 2006

```Hi Adrian,

You could do this easily from commandline  - if you know where to find
your data. EEG.data is (after epoching!) a  3-D matrix: Channels x
Frames x Trials. Thus, averaging over the third dimension gives you the
ERP. For plotting the ERP of a specific channel just enter the channel
index, e.g., for channel 12, erp = mean(EEG.data(12,:,:),3); For
comparing two or more conditions (or subjects), you need to load the
single-condition datasets first. Let's assume the first loaded dataset
is condition A and the second refers to condition B. You have access to
these single datasets via ALLEEG, that is, ALLEEG(idx).data:

erpa = mean(ALLEEG(1).data(12,:,:),3);
erpb = mean(ALLEEG(2).data(12,:,:),3);
figure;
hold on;
plot(EEG.times,erpa, 'b');
plot(EEG.times,erpb, 'r');
set(gca, 'Ydir', 'reverse');
title('ERP at channel 12');

Play a bit with the code and you will soon be able to improve it. E.g.,
interesteing information could be added to the plot, such as the number
of trials for each condition (into the title), difference ERPs, or
odd/even split averages to asses the SNR...

Hope this helps,
Stefan

. The code below retunrs the

> Hi,
>
> I'm having a hard time plotting single channels ERPs for two different
> conditions from the command line.
>
> I can get all the channels plotted in the scalp array easily enough
> using the pop_comperp command.  But I can't seem to be able to do the
> equivalent of clicking on one of the plots and having it open up in a
> new window from the command line.  I've managed to find the copyaxis
> function that will open up a new window and display the axes.  Does
> anyone know how to get the actual waveforms displayed there as well?
> Or an alternative method for plotting two conditions (datasets) at one
> channel?  Thanks,
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> eeglablist mailing list eeglablist at sccn.ucsd.edu
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu

```