<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear George,<div><br></div><div>Your approach was right, and it would have worked with older versions of field trip. Now in field trip the grad field contents have changed a little bit.</div><div><br></div><div>Now it contains</div><div><br></div><div><div>balance: [1x1 struct]</div><div>     chanori: [306x3 double]</div><div>     chanpos: [306x3 double]</div><div>    chantype: {306x1 cell}</div><div>    chanunit: {306x1 cell}</div><div>     coilori: [510x3 double]</div><div>     coilpos: [510x3 double]</div><div>       label: {306x1 cell}</div><div>         tra: [306x510 double]</div><div>        unit: 'cm'</div><div><br></div><div>so the field put would be chanpos, ori would be chanori (or coilpos/ coilori depending on your MEG system).</div><div><br></div><div>So check this out and you can easily adapt the structure. I think SPM does not go with the últimate field trip version.</div><div><br></div><div>I hope this helps,</div><div><br></div><div>best,</div><div><br></div><div>Stephan</div><div><br></div><div apple-content-edited="true">
<div><div>________________________________________________________</div><div>Stephan Moratti, PhD<br><br></div><div>see also: <a href="http://web.me.com/smoratti/">http://web.me.com/smoratti/</a><br><br></div><div>Universidad Complutense de Madrid</div><div>Facultad de Psicología</div><div>Departamento de Psicología Básica I</div><div>Campus de Somosaguas</div><div>28223 Pozuelo de Alarcón (Madrid)</div><div>Spain</div><div><br></div><div>and</div><div><br></div><div>Center for Biomedical Technology</div><div>Laboratory for Cognitive and Computational Neuroscience</div><div>Parque Científico y Tecnológico de la Universidad Politecnica de Madrid<br>Campus Montegancedo</div><div>28223 Pozuelo de Alarcón (Madrid)</div><div>Spain<br><br><br>email: <a href="mailto:smoratti@psi.ucm.es">smoratti@psi.ucm.es</a><br>Tel.:    +34 679219982</div></div>
</div>
<br><div><div>El 10/09/2012, a las 14:22, George Wallis escribió:</div><br class="Apple-interchange-newline"><blockquote type="cite">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>
_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</blockquote></div><br></div></body></html>