sensor numbers on topoplot

Jan Mathijs Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Mon Sep 10 14:43:40 CEST 2007

Dear Sameer,

Let's again have a look at the code together.

In topoplotER it states

% Draw topoplot:
if ~isfield(cfg, 'layout')
   tmpcfg = cfg;
   tmpcfg = rmfield(cfg,'layout');

(lines 365 onwards)

This means the function topoplot is called, and it receives 5 input
arguments. Additionally, a potential layout-field in the tmpcfg-structure is
removed. This means that the only information topoplot gets regarding the
channels, and the data are the ordered vectors chanX, chanY and datavector,
and the cell-array chanLabels. When you look a bit back in the code, you'll
find out that these variables represent the following things:

-chanX = the x-coordinate for the topographical projection
-chanY = the y-coordinate for the topographical projection
-datavector = the value to be plotted
-chanLabels = the name of the corresponding channel.

Note that the physical order of the entries within these arrays is not
relevant, and as long as you randomly shuffle them all in the same way the
resulting topographic representation will not be affected. BUT the actual
order in which the channels are ordered does affect the (arbitrary) numbers
topoplot connects to these sensors when you specify cfg.electrodes =
'numbers'. As I said in a previous mail, within topoplot there is just a
stupid for-loop, which assigns to each electrode a number, using int2str.
This procedure is actually blind for the order in which the channel names
are specified in the layout-file (and thus the corresponding numbers in the
said layout-file), and only reflects the order in which the channels are
represented in the data you give as an input to the plotting function.

Therefore, it does not make sense to compare the numbers on the topoplot
with lay.label, but you should compare them with the label-array in your



-----Original Message-----
From: Sameer Walawalkar [mailto:sameer at]
Sent: Friday, September 07, 2007 3:46 PM
To: Jan Mathijs Schoffelen
Subject: Re: [FIELDTRIP] sensor numbers on topoplot

Dear Jan-Mathijs,

Unfortunately, it seems I was not very clear in my earlier email about my

The 240th line in NM306all.lay  ** is **  2121, and that is reflected in
(as noted in my earlier email)

>> find(strcmp(lay.label,'2121'))

ans =


However the sensor number corresponding to sensor position 2121 on the
topoplot generated using topoplot.m ** is not ** 240, it is 289.

To clarify my question I have made available a jpeg of the topoplot at
issue at the following link

Please note the sensor number of the bottom midline sensor, it is 289 and
not 240 as one would expect from your clarification. 240 is somewhere off
to the left temporal area. In fact I picked up the bottom midline as an
example. None of the numbers displayed here seem to match up with the line
numbers in NM306all.lay.


The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and

More information about the fieldtrip mailing list