<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Ksenia,<div><br></div><div>The message "<span style="font-size: 13px;">Objective function is undefined at initial point” is not something from FieldTrip, but from MATLAB itself. Hence it also suggests that there is an underlying problem and not per see an issue with the organization of the data structures. </span></div><div><span style="font-size: 13px;"><br></span></div><div><span style="font-size: 13px;">I suggest you do “dbstop if error” on the command line, then start the call to ft_dipolefitting again and use the MATLAB debugger to further identify the cause of the error.</span></div><div><span style="font-size: 13px;"><br></span></div><div><span style="font-size: 13px;">If that fails to provide additional insights, you could add </span></div><div><span style="font-size: 13px;">cfg.debug = ‘saveonerror’ </span></div><div><span style="font-size: 13px;">and share the matlab file that will be created on the detection of the error (</span><a href="http://www.fieldtriptoolbox.org/faq/how_should_i_send_example_data_to_the_developers">http://www.fieldtriptoolbox.org/faq/how_should_i_send_example_data_to_the_developers</a>)<span style="font-size: 13px;">.</span></div><div><br></div><div><span style="font-size: 13px;">best</span></div><div><span style="font-size: 13px;">Robert</span></div><div><span style="font-size: 13px;"><br></span></div><div><span style="font-size: 13px;"><br></span></div><div><span style="font-size: 13px;"><br></span></div><div><span style="font-size: 13px;"><br></span><div><div><div>On 01 Sep 2015, at 12:54, Ksenia Volkova <<a href="mailto:voxxys@gmail.com">voxxys@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div><span style="font-size:12.8000001907349px">Dear fieldtrip users,</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">I have encountered a problem getting dipole fit to a topography observed on consecutive time points. I have attempted to format the data appropriately (Tzvetan, thank you for your help!), but the call to </span><span style="font-size:12.8000001907349px">ft_dipolefitting</span><span style="font-size:12.8000001907349px"> function returns the "Objective function is undefined at initial point" error both during gridsearch and nonlinear search. What could be the cause of such behavior? Could it be that electrode coordinates are somehow in a wrong format (I have taken mine from an eeglab dataset) or would they anyway be projected onto head surface and cause wrong results, but not an error?</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Thank you in advance for any help.</span><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Ksenia Volkova</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:12.8000001907349px">Dear Ksenia,</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">I would first start with the organization of the data in a format FieldTrip can sense.<br></span><span style="font-size:12.8000001907349px">data = [];<br></span><span style="font-size:12.8000001907349px">data.trial ={[chan x time]} % this is your elec x topography matrix, where topography is observed on consecutive time points<br></span><span style="font-size:12.8000001907349px">data.time = [vector-number of time points];<br></span><span style="font-size:12.8000001907349px">data.label = {?elec1?,?elec2? etc.} your electrode labels<br></span><span style="font-size:12.8000001907349px">data.elec = this is key reflecting the position of the electrodes relative to the head</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Next, you have to compute a volume conduction model. How to do so is explained here: </span><a href="http://www.fieldtriptoolbox.org/tutorial/headmodel_eeg?s[]=eeg&s[]=volume&s[]=conduction&s[]=model" rel="noreferrer" target="_blank" style="font-size:12.8000001907349px">http://www.fieldtriptoolbox.org/tutorial/headmodel_eeg?s[]=eeg&s[]=volume&s[]=conduction&s[]=model<br></a><span style="font-size:12.8000001907349px">After this you can proceed with the dipole fitting which is explained for instance here: </span><a href="http://www.fieldtriptoolbox.org/tutorial/natmeg/dipolefitting#fit_a_dipole_model_to_the_meg_data" rel="noreferrer" target="_blank" style="font-size:12.8000001907349px">http://www.fieldtriptoolbox.org/tutorial/natmeg/dipolefitting#fit_a_dipole_model_to_the_meg_data<br></a><span style="font-size:12.8000001907349px">Under cfg.latency you could specify the number of the topography you are interested in and under cfg.vol the BEM model you computed in the previous step. If you don#t have individual MRI<br></span><span style="font-size:12.8000001907349px">you can use the standard BEM model located in the ~template/headmodel/standard_</span><span style="font-size:12.8000001907349px">bem.mat. Note that before you do so you should coregister the headmodel with the electrodes using<br></span><span style="font-size:12.8000001907349px">ft_electroderealign.</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Good luck<br></span><span style="font-size:12.8000001907349px">tzvetan</span><br style="font-size:12.8000001907349px"><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">> Dear fieldtrip users,<br></span><span style="font-size:12.8000001907349px">><br></span><span style="font-size:12.8000001907349px">> I wonder if you can help me out. I have a relatively simple problem: having a topography matrix (where rows correspond to topographies, and columns correspond to channels) I want to fit a dipole to each topography. I have looked through tutorials and documentation and I've seen this example </span><a href="http://www.fieldtriptoolbox.org/example/compute_forward_simulated_data_and_apply_a_dipole_fit" rel="noreferrer" target="_blank" style="font-size:12.8000001907349px">http://www.fieldtriptoolbox.org/example/compute_forward_simulated_data_and_apply_a_dipole_fit</a><span style="font-size:12.8000001907349px">. Still, I can't figure out how I should use the toolbox to solve my problem.<br></span><span style="font-size:12.8000001907349px">><br></span><span style="font-size:12.8000001907349px">> What would be the right arguments to call ft_dipolefitting with in my case? If I have EEG data, topography matrix and channel locations, what would be the easiest way to fit a dipole to each topography?<br></span><span style="font-size:12.8000001907349px">><br></span><span style="font-size:12.8000001907349px">> Thank you in advance for any help.<br></span><span style="font-size:12.8000001907349px">><br></span><span style="font-size:12.8000001907349px">> Ksenia Volkova<br></span><span style="font-size:12.8000001907349px">> ______________________________</span><span style="font-size:12.8000001907349px">_________________<br></span><span style="font-size:12.8000001907349px">> fieldtrip mailing list<br></span><span style="font-size:12.8000001907349px">> </span><a href="mailto:fieldtrip@donders.ru.nl" style="font-size:12.8000001907349px">fieldtrip@donders.ru.nl<br></a><span style="font-size:12.8000001907349px">> </span><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" style="font-size:12.8000001907349px">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote><div><br></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></div></body></html>