<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Don,<div><br></div><div>Thanks for your message. I was able to reproduce the issue using a similar setup (using a 4D gradiometer array constructed from a dataset recorded in St.Louis). There indeed was an issue related to the reducerank option, which you indeed bypassed by explicitly specifying this to be a numeric value. Yet, ft_dipolesimulation should also work on eeg data, i.e. computing leadfields without reduced rank should also be supported.</div><div>Fortunately I see an easy solution: for one or another reason there are the following lines in ft_compute_leadfield: </div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 18px/normal Courier; color: rgb(34, 139, 34); ">if strcmpi(reducerank,'yes') || strcmpi(reducerank,'no')</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 18px/normal Courier; color: rgb(34, 139, 34); ">  reducerank = istrue(reducerank);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 18px/normal Courier; color: rgb(34, 139, 34); ">end</div><div><br></div><div>which convert the variable reducerank, if it is a string, into a boolean. The boolean variable causes the problem you reported. Note that the boolean will not be created when you specify manually that reducerank is numeric. Commenting out these lines does the trick for me, and does not seem to affect the rest of the code. I'll remove them from the code, and the latest version will be available tonight (CET). I hope for now that you can work your way around it.</div><div><br></div><div>best wishes,</div><div><br></div><div>Jan-Mathijs</div><div><br></div><div><div>On Mar 29, 2011, at 6:58 PM, Rojas, Don wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">To all:<div><br></div><div>Regarding that last email, I think I found the problem. Line 187 of ft_dipolesimulation calls ft_compute_leadfield, which in my case returned all zeros, so that explains the zeroed data in the output. If I change that line to read:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">lf = ft_compute_leadfield(dippos{trial}, sens, vol,<span style="color: #af4df0">'reducerank'</span>,2);</div><div><br></div><div>to reflect the fact that the input is gradiometer sensors, the simulation is correct. I'm thinking perhaps that code needs to detect the sensor type for input to ft_compute_leadfield.</div><div><br></div><div>Thanks,</div><div><br></div><div>Don</div><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">"Rojas, Don" <<a href="mailto:Don.Rojas@ucdenver.edu">Don.Rojas@ucdenver.edu</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">March 29, 2011 10:32:32 AM MDT<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Email discussion list for the FieldTrip project <<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>problems with ft_dipolesimulation</b><br></span></div><br><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Fieldtrippers,<div><br></div><div>I'm having difficulties trying to construct a simulated dataset using ft_dipolesimulation. I am simulating using a 4D MEG sensor array, read in from an existing dataset (this dataset poses no particular problems when used in other FT routines, but I'm only using the headshape and the gradiometer location/orientation info for the headmodel and simulation anyway). The problem is that I am getting values of zero in all channels at all time points in the simulated set. No errors are generated, but there is a message about the RMS value of simulated data is 0 when ft_dipolesimulation is run - no surprise there. Here is my code:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(49, 152, 51); ">% read 4D file</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(175, 77, 240); "><span style="color: #000000">file = </span>'c,rfhp0.1Hz'<span style="color: #000000">;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">hdr  = ft_read_header(file);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">hs   = ft_read_headshape(<span style="color: #af4df0">'hs_file'</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; min-height: 14px; "> <br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(49, 152, 51); ">% create a single sphere conductor model from 4D dataset</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg                 = [];</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg.grad            = hdr.grad;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg.headshape       = hs.pnt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg.singlesphere    = <span style="color: #af4df0">'yes'</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">ft_sphere           = ft_prepare_localspheres(cfg);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; min-height: 14px; "> <br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(49, 152, 51); ">% simulate a dipole</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.vol            = ft_sphere;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.grad           = hdr.grad;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.fsample        = hdr.Fs;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.relnoise       = .1;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.dip.frequency  = 20;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.dip.phase      = pi/2; <span style="color: #319833">% 90 degree phase</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.triallength    = 1;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.ntrials        = 50;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.dip.pos        = [0 -.05 .05]; <span style="color: #319833">% position in meters</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.dip.mom        = [0 0 -1]';</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">sim                     = ft_dipolesimulation(cfg_sim);</div><div><br></div><div>Also, I have run the script from the following example:</div><div><br></div><div><a href="http://fieldtrip.fcdonders.nl/example/compute_forward_simulated_data_and_apply_a_dipole_fit">http://fieldtrip.fcdonders.nl/example/compute_forward_simulated_data_and_apply_a_dipole_fit</a></div><div><br></div><div>The simulated data in that example also has no data other than zeros in all channels. So, I don't think this is due to my code per se, which was adapted from that example. My MATLAB version is 2009b (maci64) and I've tried this in several FT versions, including the 20110328 version, all of which produce the same results.</div><div><br></div><div>Any ideas?</div><div><br></div><div>Don</div><div><br></div><div> <div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-----------------------<br>Don Rojas, Ph.D.<br>Associate Professor of Psychiatry<br>U. of Colorado Denver Anschutz Medical Campus<br>Director, UCD Magnetoencephalography Lab<br>13001 E. 17th Pl F546<br>Aurora, CO 80045</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">USA<br>303-724-4994</div> </div> <br></div></div></blockquote></div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br></div></div></div></div>_______________________________________________<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 apple-content-edited="true"> <div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Dr. J.M. (Jan-Mathijs) Schoffelen </div><div>Donders Institute for Brain, Cognition and Behaviour, <br>Centre for Cognitive Neuroimaging,<br>Radboud University Nijmegen, The Netherlands</div><div><a href="mailto:J.Schoffelen@donders.ru.nl">J.Schoffelen@donders.ru.nl</a></div><div>Telephone: 0031-24-3614793</div></div></span></div> </div><br></div></body></html>