<div><div class="gmail_quote"><div><br></div><div>Dear all, <div>I've solved the forward problem for a FEM head model and as a result, obtained the lead field matrix. Now I'm going to do the Dipole Fit approch in order to solve the inverse problem. How can I obtain the ' EEG-avg ' data in the script below which is a part of "<a href="http://www.fieldtriptoolbox.org/workshop/baci2017/inverseproblem" target="_blank">http://www.fieldtriptoolbox.org/workshop/baci2017/inverseproblem</a>" due to the forward problem once I solved? </div><div>Thank you!</div><div><br></div><div>

<pre class="m_-3814156035773704855gmail-code m_-3814156035773704855gmail-matlab" style="box-sizing:border-box;overflow:auto;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:13px;display:block;padding:9.5px;margin:0px 0px 10px;line-height:1.42857;word-break:break-all;word-wrap:break-word;color:rgb(51,51,51);background-color:rgb(245,245,245);border:1px solid rgb(204,204,204);border-radius:4px;white-space:pre-wrap;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/load.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:none" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">load</span></a> elec
<a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/load.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:none" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">load</span></a> sourcemodel
<a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/load.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:none" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">load</span></a> headmodel_bem
<a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/load.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:none" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">load</span></a> leadfield_bem
<a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/load.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:none" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">load</span></a> mri_resliced
<a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/load.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:none" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">load</span></a> EEG_avg</pre><p style="box-sizing:border-box;margin:0px 0px 10px;color:rgb(102,102,102);font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Then we do the dipole fit</p><pre class="m_-3814156035773704855gmail-code m_-3814156035773704855gmail-matlab" style="box-sizing:border-box;overflow:auto;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:13px;display:block;padding:9.5px;margin:0px 0px 10px;line-height:1.42857;word-break:break-all;word-wrap:break-word;color:rgb(51,51,51);background-color:rgb(245,245,245);border:1px solid rgb(204,204,204);border-radius:4px;white-space:pre-wrap;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">% Dipole fit</span>
cfg = <span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">[</span><span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">]</span>;
cfg.<span class="m_-3814156035773704855gmail-me1" style="box-sizing:border-box;color:rgb(0,102,0)">numdipoles</span>    =  <span class="m_-3814156035773704855gmail-nu0" style="box-sizing:border-box;color:rgb(204,102,204)">1</span>;                             <span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">%number of expected </span>
cfg.<span class="m_-3814156035773704855gmail-me1" style="box-sizing:border-box;color:rgb(0,102,0)">headmodel</span>     = headmodel_bem;                  <span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">%the head model</span>
cfg.<a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/grid.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:none" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">grid</span></a>          = leadfield_bem;                  <span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">%the precomputed leadfield</span>
cfg.<span class="m_-3814156035773704855gmail-me1" style="box-sizing:border-box;color:rgb(0,102,0)">elec</span>          = elec;                           <span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">%the electrode model</span>
cfg.<span class="m_-3814156035773704855gmail-me1" style="box-sizing:border-box;color:rgb(0,102,0)">latency</span>       = <span class="m_-3814156035773704855gmail-nu0" style="box-sizing:border-box;color:rgb(204,102,204)">0.025</span>;                          <span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">%the latency of interest</span>
dipfit_bem        = ft_dipolefitting<span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">(</span>cfg,EEG_avg<span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">)</span>;</pre><pre class="m_-3814156035773704855gmail-code m_-3814156035773704855gmail-matlab" style="box-sizing:border-box;overflow:auto;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:13px;display:block;padding:9.5px;margin:0px 0px 10px;line-height:1.42857;word-break:break-all;word-wrap:break-word;color:rgb(51,51,51);background-color:rgb(245,245,245);border:1px solid rgb(204,204,204);border-radius:4px;white-space:pre-wrap;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">dipfit_bem.<span class="m_-3814156035773704855gmail-me1" style="box-sizing:border-box;color:rgb(0,102,0)">dip</span>
 
<a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/ans.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:none" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">ans</span></a> = 
 
     pos: <span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">[</span><span class="m_-3814156035773704855gmail-nu0" style="box-sizing:border-box;color:rgb(204,102,204)">13.958237048680118</span> <span class="m_-3814156035773704855gmail-nu0" style="box-sizing:border-box;color:rgb(204,102,204)">34.388465910583285</span> <span class="m_-3814156035773704855gmail-nu0" style="box-sizing:border-box;color:rgb(204,102,204)">97.809684095994314</span><span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">]</span> <span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">%dipole position</span>
     mom: <span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">[</span>3x1 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:underline;outline:-webkit-focus-ring-color auto 5px" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">double</span></a><span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">]</span>                                               <span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">%dipole moment</span>
     pot: <span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">[</span>74x1 <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html" style="box-sizing:border-box;background-color:transparent;color:rgb(51,153,243);text-decoration:none" target="_blank"><span class="m_-3814156035773704855gmail-kw2" style="box-sizing:border-box;color:rgb(0,0,0);font-weight:bold">double</span></a><span class="m_-3814156035773704855gmail-br0" style="box-sizing:border-box;color:rgb(102,204,102)">]</span>                                              <span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">%potential at the electrodes</span>
      rv: <span class="m_-3814156035773704855gmail-nu0" style="box-sizing:border-box;color:rgb(204,102,204)">0.034549469532012</span>                                          <span class="m_-3814156035773704855gmail-co1" style="box-sizing:border-box;color:rgb(128,128,128);font-style:italic">%residual variance</span>
    unit: <span class="m_-3814156035773704855gmail-co2" style="box-sizing:border-box;color:rgb(51,153,51)">'mm'</span></pre>

<br></div></div></div></div>