Dear fieldtrippers,<br><br>if anyone can help me with this I'd be very grateful!<br><br>I have a bunch of preprocessed and epoched data files in SPM format, and I'm converting them to fieldtrip format using the following:<br>
<br>D  = spm_eeg_load(fn);<br>
data = D.ftraw(0);<br><br>...which results in...<br><br>data = <br><br>    fsample: 250<br>      label: {350x1 cell}<br>      trial: {1x360 cell}<br>       time: {1x360 cell}<br><br>Comparing this to data structures generated using fieldtrip alone, field like data.grad are missing.<br>

<br>I can create something like a grad field by doing:<br><br>D.sensors('MEG')<br><br>ans = <br><br>      pnt: [510x3 double]<br>      ori: [510x3 double]<br>      tra: [306x510 double]<br>     unit: 'mm'<br>

    label: {306x1 cell}<br><br>If I then append this to the data:<br><br>data.grad = D.sensors('MEG');<br><br>I get an error:<br><br>--- <br><br>Error using ft_chantype (line 56)<br>the input that was provided to this function cannot be deciphered<br>
<br>Error in ft_datatype_sens (line 128)<br>        sens.chantype = ft_chantype(sens);<br><br>Error in ft_datatype_raw (line 99)<br>      data.grad = ft_datatype_sens(data.grad);<br><br>Error in ft_checkdata (line 177)<br>
  data = ft_datatype_raw(data, 'hassampleinfo', hassampleinfo);<br><br>Error in ft_timelockanalysis (line 134)<br>data = ft_checkdata(data, 'datatype', {'raw', 'comp'}, 'feedback', 'yes', 'hassampleinfo',<br>
'yes');<br><br>Error in ft_SENS_ERF_grRep (line 82)<br>            avdat = ft_timelockanalysis(cfg,raw);<br><br>---<br><br>...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.<br>
<br>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:<br>
<br>isgrad   = isa(input, 'struct') && isfield(input, 'pnt') && isfield(input, 'ori');<br><br>I'm wondering if this could be the problem?<br><br>Sorry for the long message!  I'd be very grateful if anyone can help out.<br>
<br>Best wishes,<br>George<br>