<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi everyone,<br><br>I'm Thomas, a Master's student in Paul Cisek's lab at Université de Montréal, Canada, and also a FieldTrip newbie. My project is to analyse LFP data from <a href="https://www.graymatter-research.com/32-channel-microdrive-system-sc32/" target="_blank">chronically implanted electrodes</a> in monkeys during a decision-making task. FieldTrip seems to be the best, most complete tool for this job. However.<div><br>Since we have years worth of data, we have everything stored and organized (with extensive bookkeeping) in an SQL database and have an in-house toolbox to get it into MATLAB. This means using the original files created every day is counter-productive in my situation. Therefore, I have tried to create a data structure that would work with FT functions by getting data from our database, however FieldTrip seems to <i>really</i> want to get its data from files. <br><br>Has using self-made data structures ever been done? <i>Can</i> it be done? <br><br>In time, I would like to use as many FieldTrip functions as is applicable, but I tried to start by using <font face="courier new, monospace">ft_freqanalysis</font><font face="arial, sans-serif"> to get time-frequency representations. Here's<br></font><br><br>Here's what I did:<br><br><br><b>1- Get the data for a subset of my choosing (I tried everything with a small 4-channel, 55-trials subset)<br><br></b></div><div><b>2- Put that data into a structure built as follows, adding fields that FieldTrip required:</b><br><div><br></div><div><font face="courier new, monospace">    fsample: 1017           </font>(I know this is weird but we're stuck with it)</div><div><font face="courier new, monospace">   channels: [1 17 25 29]   </font>Added to keep track of in-house bookkeeping</div><div><font face="courier new, monospace">      label: {'Ch:1 idElectrodeSite:181'  'Ch:17 idElectrodeSite:183'  'Ch:25 idElectrodeSite:184'  <br>              'Ch:29 idElectrodeSite:185'}  </font>Not the right structure, but I don't have header files to get them from</div><div><font face="courier new, monospace">      trial: {55×1 cell}    </font>One cell per trial, with each being<font face="courier new, monospace"> [chan x time]</font></div><div><font face="courier new, monospace">       time: {55×1 cell}    </font>One cell per trial, each going from -750ms to 750ms (around target onset) This includes a 250ms pad on each side.</div><div><font face="courier new, monospace">        trl: [55×3 double]  </font>Built from scratch as if the trials were continuous. (Inspired by the FT function that does this) </div><div><font face="courier new, monospace">     dimord: 'chan_time'    </font>Added by hand, can't get Fieldtrip to recognize it</div><div><font face="courier new, monospace"> sampleinfo: [55×2 double]  </font>The first two columns of <font face="courier new, monospace">trl</font></div></div><div><font face="courier new, monospace"><br></font></div><div><font face="arial, sans-serif"><b>3- Try to use ft_freqanalysis using the following cfg (also attached)<br><br></b></font></div><div><font face="courier new, monospace">cfg = [];<br>cfg.method= 'tfr';<br>cfg.pad = 'nextpow2';<br>cfg.width = 7;<br>cfg.gwidth = 3;<br>cfg.foi = [15:1:60];<br>cfg.toi = 'all';</font><br></div><div><font face="arial, sans-serif"><br>I first get the message: <br></font><font face="courier new, monospace">the input is raw data with 4 channels and 55 trial<br></font><font face="arial, sans-serif">This would be encouraging, but then, </font><span style="font-family:arial,sans-serif">I get the following warnings:</span></div><div><font face="courier new, monospace"><br>Warning: could not determine dimord of "trial" in: </font><font face="arial, sans-serif">(structure shown above)</font><br></div><div><div><font face="courier new, monospace">Warning: could not determine dimord of "trl" in:   </font><span style="font-family:arial,sans-serif">(structure shown above)<br>...but four pairs of them.<br><br>Looking through the debugger, I found out they're given when </span><span style="font-family:arial,sans-serif">ft_freqanalysis, calls ft_checkdata and ft_selectdata. <br></span><span style="font-family:arial,sans-serif"><b>Are these warnings something I should be worried about, or can everything work well the way it is?</b> <br>Also, how is it that FT 'could not determine dimord' when I give it one in the data structure, and it seems to understand the way it works given the message it sends at the beginning?<br><br></span></div><div><span style="font-family:arial,sans-serif">After the warnings, I get this:<br></span><font face="courier new, monospace"><br>the call to "ft_selectdata" took 16 seconds<br>processing trials<br>trial 2, frequency 32 (46.18 Hz)<br><font color="#ff0000">Array dimensions must match for binary array op.<br><br>Error in ft_freqanalysis (line 679)<br>            trlcnt(1, ifoi, :) = trlcnt(1, ifoi, :) + shiftdim(double(acttboi(:)'),-1);<br></font></font><span style="font-family:arial,sans-serif"><br></span></div></div><div><font face="arial, sans-serif">...which I simply don't know how to solve.<br><br><br><b>So in summary:</b> <br><br>1- Is it possible to make FT work without using original files to get the data?<br>2- If it is, what have I done wrong, and how could I make it work?<br>3- Are the warnings worrisome or is it just a natural consequence of trying to jerry-rig data in FT?<br>4- Any idea on how to solve the error message I get is appreciated, but a secondary objective. <br><br>I attached the function I made to build the data structure in case it could help.<br><br><br>Thank you very much for reading this long-winded message!<br><br>Regards<br><br>Thomas Lusignan, B. Sc. <br>Paul Cisek's Lab<br>Université de Montréal</font></div></div></div></div></div></div></div></div>
</div></div>
</div></div>