[FieldTrip] Appending data.grad, after using D.ftraw(0)

George Wallis wallisgj at gmail.com
Mon Sep 10 14:22:20 CEST 2012

Dear fieldtrippers,

if anyone can help me with this I'd be very grateful!

I have a bunch of preprocessed and epoched data files in SPM format, and
I'm converting them to fieldtrip format using the following:

D  = spm_eeg_load(fn);
data = D.ftraw(0);

...which results in...

data =

    fsample: 250
      label: {350x1 cell}
      trial: {1x360 cell}
       time: {1x360 cell}

Comparing this to data structures generated using fieldtrip alone, field
like data.grad are missing.

I can create something like a grad field by doing:


ans =

      pnt: [510x3 double]
      ori: [510x3 double]
      tra: [306x510 double]
     unit: 'mm'
    label: {306x1 cell}

If I then append this to the data:

data.grad = D.sensors('MEG');

I get an error:


Error using ft_chantype (line 56)
the input that was provided to this function cannot be deciphered

Error in ft_datatype_sens (line 128)
        sens.chantype = ft_chantype(sens);

Error in ft_datatype_raw (line 99)
      data.grad = ft_datatype_sens(data.grad);

Error in ft_checkdata (line 177)
  data = ft_datatype_raw(data, 'hassampleinfo', hassampleinfo);

Error in ft_timelockanalysis (line 134)
data = ft_checkdata(data, 'datatype', {'raw', 'comp'}, 'feedback', 'yes',

Error in ft_SENS_ERF_grRep (line 82)
            avdat = ft_timelockanalysis(cfg,raw);


...when I try to do timelockanalysis on this data.  If I leave the grad
field off (i.e. not append it to the output of ftraw(0)) there's no
problem, and the analysis runs fine.  However, because I want to do spatial
neighbour cluster analysis later, I think I need the .grad field, so I
might as well get it incorporated at this stage.

Going a bit further into the error messages above, the function
ft_datatype_sens appears to convert the old format .ori, .pnt into the
newer .coilori, .coilpos ... etc.  But the next function in the chain,
ft_chantype, looks for .pnt and .ori when doing:

isgrad   = isa(input, 'struct') && isfield(input, 'pnt') && isfield(input,

I'm wondering if this could be the problem?

Sorry for the long message!  I'd be very grateful if anyone can help out.

Best wishes,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120910/8418e2de/attachment-0001.html>

More information about the fieldtrip mailing list